1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Support: Change InMemoryFileSystem::addFileNoOwn to take a MemoryBufferRef, NFC

Found this by chance when looking at the InMemoryFileSystem API, seems
like an easy cleanup.

Differential Revision: https://reviews.llvm.org/D90893
This commit is contained in:
Duncan P. N. Exon Smith 2020-11-05 18:23:19 -05:00 committed by Duncan P. N. Exon Smith
parent 47e9765193
commit fac28722eb
3 changed files with 6 additions and 6 deletions

View File

@ -37,6 +37,7 @@
namespace llvm {
class MemoryBuffer;
class MemoryBufferRef;
class Twine;
namespace vfs {
@ -463,7 +464,8 @@ public:
/// false if the file or directory already exists in the file system with
/// different contents.
bool addFileNoOwn(const Twine &Path, time_t ModificationTime,
llvm::MemoryBuffer *Buffer, Optional<uint32_t> User = None,
const llvm::MemoryBufferRef &Buffer,
Optional<uint32_t> User = None,
Optional<uint32_t> Group = None,
Optional<llvm::sys::fs::file_type> Type = None,
Optional<llvm::sys::fs::perms> Perms = None);

View File

@ -792,14 +792,12 @@ bool InMemoryFileSystem::addFile(const Twine &P, time_t ModificationTime,
}
bool InMemoryFileSystem::addFileNoOwn(const Twine &P, time_t ModificationTime,
llvm::MemoryBuffer *Buffer,
const llvm::MemoryBufferRef &Buffer,
Optional<uint32_t> User,
Optional<uint32_t> Group,
Optional<llvm::sys::fs::file_type> Type,
Optional<llvm::sys::fs::perms> Perms) {
return addFile(P, ModificationTime,
llvm::MemoryBuffer::getMemBuffer(
Buffer->getBuffer(), Buffer->getBufferIdentifier()),
return addFile(P, ModificationTime, llvm::MemoryBuffer::getMemBuffer(Buffer),
std::move(User), std::move(Group), std::move(Type),
std::move(Perms));
}

View File

@ -939,7 +939,7 @@ TEST_F(InMemoryFileSystemTest, OverlayFile) {
TEST_F(InMemoryFileSystemTest, OverlayFileNoOwn) {
auto Buf = MemoryBuffer::getMemBuffer("a");
FS.addFileNoOwn("/a", 0, Buf.get());
FS.addFileNoOwn("/a", 0, *Buf);
auto Stat = FS.status("/a");
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
ASSERT_EQ("/a", Stat->getName());