[PATCH] D50470: ELF: Inline function LazyObjFile::getBuffer() into caller. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 8 13:22:34 PDT 2018
pcc created this revision.
pcc added a reviewer: ruiu.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
It's a little confusing for a function named getSomething() to be
mutating anything. Inlining this function should make it a little
clearer what's going on.
Repository:
rL LLVM
https://reviews.llvm.org/D50470
Files:
lld/ELF/InputFiles.cpp
lld/ELF/InputFiles.h
Index: lld/ELF/InputFiles.h
===================================================================
--- lld/ELF/InputFiles.h
+++ lld/ELF/InputFiles.h
@@ -267,7 +267,6 @@
static bool classof(const InputFile *F) { return F->kind() == LazyObjKind; }
template <class ELFT> void parse();
- MemoryBufferRef getBuffer();
InputFile *fetch();
bool AddedToLink = false;
Index: lld/ELF/InputFiles.cpp
===================================================================
--- lld/ELF/InputFiles.cpp
+++ lld/ELF/InputFiles.cpp
@@ -1233,19 +1233,12 @@
}
}
-MemoryBufferRef LazyObjFile::getBuffer() {
- if (AddedToLink)
- return MemoryBufferRef();
- AddedToLink = true;
- return MB;
-}
-
InputFile *LazyObjFile::fetch() {
- MemoryBufferRef MBRef = getBuffer();
- if (MBRef.getBuffer().empty())
+ if (AddedToLink)
return nullptr;
+ AddedToLink = true;
- InputFile *File = createObjectFile(MBRef, ArchiveName, OffsetInArchive);
+ InputFile *File = createObjectFile(MB, ArchiveName, OffsetInArchive);
File->GroupId = GroupId;
return File;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50470.159773.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180808/dd437e60/attachment.bin>
More information about the llvm-commits
mailing list