[lld] r312170 - Move a function from Driver.cpp to InputFile.cpp.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 30 13:55:18 PDT 2017
Author: ruiu
Date: Wed Aug 30 13:55:18 2017
New Revision: 312170
URL: http://llvm.org/viewvc/llvm-project?rev=312170&view=rev
Log:
Move a function from Driver.cpp to InputFile.cpp.
This patch doesn't improve code per se, but it should make the following
patch's diff easier to read.
Modified:
lld/trunk/COFF/Driver.cpp
lld/trunk/COFF/InputFiles.cpp
lld/trunk/COFF/InputFiles.h
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=312170&r1=312169&r2=312170&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Wed Aug 30 13:55:18 2017
@@ -522,25 +522,6 @@ static void parseModuleDefs(StringRef Pa
}
}
-std::vector<MemoryBufferRef> getArchiveMembers(Archive *File) {
- std::vector<MemoryBufferRef> V;
- Error Err = Error::success();
- for (const ErrorOr<Archive::Child> &COrErr : File->children(Err)) {
- Archive::Child C =
- check(COrErr,
- File->getFileName() + ": could not get the child of the archive");
- MemoryBufferRef MBRef =
- check(C.getMemoryBufferRef(),
- File->getFileName() +
- ": could not get the buffer for a child of the archive");
- V.push_back(MBRef);
- }
- if (Err)
- fatal(File->getFileName() +
- ": Archive::children failed: " + toString(std::move(Err)));
- return V;
-}
-
// A helper function for filterBitcodeFiles.
static bool needsRebuilding(MemoryBufferRef MB) {
// The MSVC linker doesn't support thin archives, so if it's a thin
Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=312170&r1=312169&r2=312170&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Wed Aug 30 13:55:18 2017
@@ -83,6 +83,25 @@ void ArchiveFile::addMember(const Archiv
Driver->enqueueArchiveMember(C, Sym->getName(), getName());
}
+std::vector<MemoryBufferRef> getArchiveMembers(Archive *File) {
+ std::vector<MemoryBufferRef> V;
+ Error Err = Error::success();
+ for (const ErrorOr<Archive::Child> &COrErr : File->children(Err)) {
+ Archive::Child C =
+ check(COrErr,
+ File->getFileName() + ": could not get the child of the archive");
+ MemoryBufferRef MBRef =
+ check(C.getMemoryBufferRef(),
+ File->getFileName() +
+ ": could not get the buffer for a child of the archive");
+ V.push_back(MBRef);
+ }
+ if (Err)
+ fatal(File->getFileName() +
+ ": Archive::children failed: " + toString(std::move(Err)));
+ return V;
+}
+
void ObjFile::parse() {
// Parse a memory buffer as a COFF file.
std::unique_ptr<Binary> Bin = check(createBinary(MB), toString(this));
Modified: lld/trunk/COFF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.h?rev=312170&r1=312169&r2=312170&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.h (original)
+++ lld/trunk/COFF/InputFiles.h Wed Aug 30 13:55:18 2017
@@ -31,6 +31,8 @@ class DbiModuleDescriptorBuilder;
namespace lld {
namespace coff {
+std::vector<MemoryBufferRef> getArchiveMembers(llvm::object::Archive *File);
+
using llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN;
using llvm::COFF::MachineTypes;
using llvm::object::Archive;
More information about the llvm-commits
mailing list