[lld] r309228 - Rename ObjectFile ObjFile for COFF as well.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 26 16:05:24 PDT 2017
Author: ruiu
Date: Wed Jul 26 16:05:24 2017
New Revision: 309228
URL: http://llvm.org/viewvc/llvm-project?rev=309228&view=rev
Log:
Rename ObjectFile ObjFile for COFF as well.
Modified:
lld/trunk/COFF/Chunks.cpp
lld/trunk/COFF/Chunks.h
lld/trunk/COFF/Driver.cpp
lld/trunk/COFF/InputFiles.cpp
lld/trunk/COFF/InputFiles.h
lld/trunk/COFF/MapFile.cpp
lld/trunk/COFF/PDB.cpp
lld/trunk/COFF/SymbolTable.cpp
lld/trunk/COFF/SymbolTable.h
lld/trunk/COFF/Symbols.cpp
lld/trunk/COFF/Symbols.h
lld/trunk/COFF/Writer.cpp
Modified: lld/trunk/COFF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.cpp?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.cpp (original)
+++ lld/trunk/COFF/Chunks.cpp Wed Jul 26 16:05:24 2017
@@ -29,7 +29,7 @@ using llvm::support::ulittle32_t;
namespace lld {
namespace coff {
-SectionChunk::SectionChunk(ObjectFile *F, const coff_section *H)
+SectionChunk::SectionChunk(ObjFile *F, const coff_section *H)
: Chunk(SectionKind), Repl(this), Header(H), File(F),
Relocs(File->getCOFFObj()->getRelocations(Header)),
NumRelocs(std::distance(Relocs.begin(), Relocs.end())) {
Modified: lld/trunk/COFF/Chunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.h?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.h (original)
+++ lld/trunk/COFF/Chunks.h Wed Jul 26 16:05:24 2017
@@ -33,7 +33,7 @@ class Baserel;
class Defined;
class DefinedImportData;
class DefinedRegular;
-class ObjectFile;
+class ObjFile;
class OutputSection;
class SymbolBody;
@@ -122,9 +122,9 @@ public:
std::random_access_iterator_tag, SymbolBody *> {
friend SectionChunk;
- ObjectFile *File;
+ ObjFile *File;
- symbol_iterator(ObjectFile *File, const coff_relocation *I)
+ symbol_iterator(ObjFile *File, const coff_relocation *I)
: symbol_iterator::iterator_adaptor_base(I), File(File) {}
public:
@@ -135,7 +135,7 @@ public:
}
};
- SectionChunk(ObjectFile *File, const coff_section *Header);
+ SectionChunk(ObjFile *File, const coff_section *Header);
static bool classof(const Chunk *C) { return C->kind() == SectionKind; }
size_t getSize() const override { return Header->SizeOfRawData; }
ArrayRef<uint8_t> getContents() const;
@@ -213,7 +213,7 @@ public:
const coff_section *Header;
// The file that this chunk was created from.
- ObjectFile *File;
+ ObjFile *File;
private:
StringRef SectionName;
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Wed Jul 26 16:05:24 2017
@@ -127,7 +127,7 @@ void LinkerDriver::addBuffer(std::unique
error(MBRef.getBufferIdentifier() + ": is not a native COFF file. "
"Recompile without /GL");
else
- Symtab.addFile(make<ObjectFile>(MBRef));
+ Symtab.addFile(make<ObjFile>(MBRef));
}
void LinkerDriver::enqueuePath(StringRef Path) {
@@ -153,7 +153,7 @@ void LinkerDriver::addArchiveBuffer(Memo
InputFile *Obj;
if (Magic == file_magic::coff_object) {
- Obj = make<ObjectFile>(MB);
+ Obj = make<ObjFile>(MB);
} else if (Magic == file_magic::bitcode) {
Obj = make<BitcodeFile>(MB);
} else {
@@ -610,7 +610,7 @@ void LinkerDriver::invokeMSVC(opt::Input
// Write out archive members that we used in symbol resolution and pass these
// to MSVC before any archives, so that MSVC uses the same objects to satisfy
// references.
- for (const auto *O : Symtab.ObjectFiles) {
+ for (const auto *O : Symtab.ObjFiles) {
if (O->ParentName.empty())
continue;
SmallString<128> S;
@@ -651,8 +651,8 @@ void LinkerDriver::invokeMSVC(opt::Input
}
}
- std::vector<StringRef> ObjectFiles = Symtab.compileBitcodeFiles();
- runMSVCLinker(Rsp, ObjectFiles);
+ std::vector<StringRef> ObjFiles = Symtab.compileBitcodeFiles();
+ runMSVCLinker(Rsp, ObjFiles);
for (StringRef Path : Temps)
sys::fs::remove(Path);
@@ -1143,7 +1143,7 @@ void LinkerDriver::link(ArrayRef<const c
// Handle /safeseh.
if (Args.hasArg(OPT_safeseh)) {
- for (ObjectFile *File : Symtab.ObjectFiles)
+ for (ObjFile *File : Symtab.ObjFiles)
if (!File->SEHCompat)
error("/safeseh: " + File->getName() + " is not compatible with SEH");
if (ErrorCount)
Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Wed Jul 26 16:05:24 2017
@@ -79,7 +79,7 @@ void ArchiveFile::addMember(const Archiv
Driver->enqueueArchiveMember(C, Sym->getName(), getName());
}
-void ObjectFile::parse() {
+void ObjFile::parse() {
// Parse a memory buffer as a COFF file.
std::unique_ptr<Binary> Bin = check(createBinary(MB), toString(this));
@@ -96,7 +96,7 @@ void ObjectFile::parse() {
initializeSEH();
}
-void ObjectFile::initializeChunks() {
+void ObjFile::initializeChunks() {
uint32_t NumSections = COFFObj->getNumberOfSections();
Chunks.reserve(NumSections);
SparseChunks.resize(NumSections + 1);
@@ -147,7 +147,7 @@ void ObjectFile::initializeChunks() {
}
}
-void ObjectFile::initializeSymbols() {
+void ObjFile::initializeSymbols() {
uint32_t NumSymbols = COFFObj->getNumberOfSymbols();
SymbolBodies.reserve(NumSymbols);
SparseSymbolBodies.resize(NumSymbols);
@@ -193,14 +193,14 @@ void ObjectFile::initializeSymbols() {
}
}
-SymbolBody *ObjectFile::createUndefined(COFFSymbolRef Sym) {
+SymbolBody *ObjFile::createUndefined(COFFSymbolRef Sym) {
StringRef Name;
COFFObj->getSymbolName(Sym, Name);
return Symtab->addUndefined(Name, this, Sym.isWeakExternal())->body();
}
-SymbolBody *ObjectFile::createDefined(COFFSymbolRef Sym, const void *AuxP,
- bool IsFirst) {
+SymbolBody *ObjFile::createDefined(COFFSymbolRef Sym, const void *AuxP,
+ bool IsFirst) {
StringRef Name;
if (Sym.isCommon()) {
auto *C = make<CommonChunk>(Sym);
@@ -273,7 +273,7 @@ SymbolBody *ObjectFile::createDefined(CO
return B;
}
-void ObjectFile::initializeSEH() {
+void ObjFile::initializeSEH() {
if (!SEHCompat || !SXData)
return;
ArrayRef<uint8_t> A;
@@ -286,7 +286,7 @@ void ObjectFile::initializeSEH() {
SEHandlers.insert(SparseSymbolBodies[*I]);
}
-MachineTypes ObjectFile::getMachineType() {
+MachineTypes ObjFile::getMachineType() {
if (COFFObj)
return static_cast<MachineTypes>(COFFObj->getMachine());
return IMAGE_FILE_MACHINE_UNKNOWN;
Modified: lld/trunk/COFF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.h?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.h (original)
+++ lld/trunk/COFF/InputFiles.h Wed Jul 26 16:05:24 2017
@@ -101,9 +101,9 @@ private:
};
// .obj or .o file. This may be a member of an archive file.
-class ObjectFile : public InputFile {
+class ObjFile : public InputFile {
public:
- explicit ObjectFile(MemoryBufferRef M) : InputFile(ObjectKind, M) {}
+ explicit ObjFile(MemoryBufferRef M) : InputFile(ObjectKind, M) {}
static bool classof(const InputFile *F) { return F->kind() == ObjectKind; }
void parse() override;
MachineTypes getMachineType() override;
Modified: lld/trunk/COFF/MapFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/MapFile.cpp?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/MapFile.cpp (original)
+++ lld/trunk/COFF/MapFile.cpp Wed Jul 26 16:05:24 2017
@@ -48,7 +48,7 @@ static std::string indent(int Depth) { r
// Returns a list of all symbols that we want to print out.
static std::vector<DefinedRegular *> getSymbols() {
std::vector<DefinedRegular *> V;
- for (coff::ObjectFile *File : Symtab->ObjectFiles)
+ for (ObjFile *File : Symtab->ObjFiles)
for (SymbolBody *B : File->getSymbols())
if (auto *Sym = dyn_cast<DefinedRegular>(B))
if (Sym && !Sym->getCOFFSymbol().isSectionDefinition())
Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Wed Jul 26 16:05:24 2017
@@ -77,7 +77,7 @@ public:
void addObjectsToPDB();
/// Link CodeView from a single object file into the PDB.
- void addObjectFile(ObjectFile *File);
+ void addObjFile(ObjFile *File);
/// Produce a mapping from the type and item indices used in the object
/// file to those in the destination PDB.
@@ -90,9 +90,9 @@ public:
/// If the object does not use a type server PDB (compiled with /Z7), we merge
/// all the type and item records from the .debug$S stream and fill in the
/// caller-provided ObjectIndexMap.
- const CVIndexMap &mergeDebugT(ObjectFile *File, CVIndexMap &ObjectIndexMap);
+ const CVIndexMap &mergeDebugT(ObjFile *File, CVIndexMap &ObjectIndexMap);
- const CVIndexMap &maybeMergeTypeServerPDB(ObjectFile *File,
+ const CVIndexMap &maybeMergeTypeServerPDB(ObjFile *File,
TypeServer2Record &TS);
/// Add the section map and section contributions to the PDB.
@@ -153,7 +153,7 @@ static ArrayRef<uint8_t> consumeDebugMag
return Data.slice(4);
}
-static ArrayRef<uint8_t> getDebugSection(ObjectFile *File, StringRef SecName) {
+static ArrayRef<uint8_t> getDebugSection(ObjFile *File, StringRef SecName) {
if (SectionChunk *Sec = findByName(File->getDebugChunks(), SecName))
return consumeDebugMagic(Sec->getContents(), SecName);
return {};
@@ -190,7 +190,7 @@ maybeReadTypeServerRecord(CVTypeArray &T
return std::move(TS);
}
-const CVIndexMap &PDBLinker::mergeDebugT(ObjectFile *File,
+const CVIndexMap &PDBLinker::mergeDebugT(ObjFile *File,
CVIndexMap &ObjectIndexMap) {
ArrayRef<uint8_t> Data = getDebugSection(File, ".debug$T");
if (Data.empty())
@@ -240,7 +240,7 @@ tryToLoadPDB(const GUID &GuidFromObj, St
return std::move(NS);
}
-const CVIndexMap &PDBLinker::maybeMergeTypeServerPDB(ObjectFile *File,
+const CVIndexMap &PDBLinker::maybeMergeTypeServerPDB(ObjFile *File,
TypeServer2Record &TS) {
// First, check if we already loaded a PDB with this GUID. Return the type
// index mapping if we have it.
@@ -296,7 +296,7 @@ static bool remapTypeIndex(TypeIndex &TI
return true;
}
-static void remapTypesInSymbolRecord(ObjectFile *File,
+static void remapTypesInSymbolRecord(ObjFile *File,
MutableArrayRef<uint8_t> Contents,
const CVIndexMap &IndexMap,
ArrayRef<TiReference> TypeRefs) {
@@ -408,7 +408,7 @@ static void scopeStackOpen(SmallVectorIm
}
static void scopeStackClose(SmallVectorImpl<SymbolScope> &Stack,
- uint32_t CurOffset, ObjectFile *File) {
+ uint32_t CurOffset, ObjFile *File) {
if (Stack.empty()) {
warn("symbol scopes are not balanced in " + File->getName());
return;
@@ -417,7 +417,7 @@ static void scopeStackClose(SmallVectorI
S.OpeningRecord->PtrEnd = CurOffset;
}
-static void mergeSymbolRecords(BumpPtrAllocator &Alloc, ObjectFile *File,
+static void mergeSymbolRecords(BumpPtrAllocator &Alloc, ObjFile *File,
const CVIndexMap &IndexMap,
BinaryStreamRef SymData) {
// FIXME: Improve error recovery by warning and skipping records when
@@ -466,7 +466,7 @@ static ArrayRef<uint8_t> relocateDebugCh
".debug$S");
}
-void PDBLinker::addObjectFile(ObjectFile *File) {
+void PDBLinker::addObjFile(ObjFile *File) {
// Add a module descriptor for every object file. We need to put an absolute
// path to the object into the PDB. If this is a plain object, we make its
// path absolute. If it's an object in an archive, we make the archive path
@@ -548,8 +548,8 @@ void PDBLinker::addObjectFile(ObjectFile
// Add all object files to the PDB. Merge .debug$T sections into IpiData and
// TpiData.
void PDBLinker::addObjectsToPDB() {
- for (ObjectFile *File : Symtab->ObjectFiles)
- addObjectFile(File);
+ for (ObjFile *File : Symtab->ObjFiles)
+ addObjFile(File);
Builder.getStringTableBuilder().setStrings(PDBStrTab);
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Wed Jul 26 16:05:24 2017
@@ -68,8 +68,8 @@ void SymbolTable::addFile(InputFile *Fil
" conflicts with " + machineToStr(Config->Machine));
}
- if (auto *F = dyn_cast<ObjectFile>(File)) {
- ObjectFiles.push_back(F);
+ if (auto *F = dyn_cast<ObjFile>(File)) {
+ ObjFiles.push_back(F);
} else if (auto *F = dyn_cast<BitcodeFile>(File)) {
BitcodeFiles.push_back(F);
} else if (auto *F = dyn_cast<ImportFile>(File)) {
@@ -135,7 +135,7 @@ void SymbolTable::reportRemainingUndefin
for (SymbolBody *B : Config->GCRoot)
if (Undefs.count(B))
warn("<root>: undefined symbol: " + B->getName());
- for (ObjectFile *File : ObjectFiles)
+ for (ObjFile *File : ObjFiles)
for (SymbolBody *Sym : File->getSymbols())
if (Undefs.count(Sym))
warn(toString(File) + ": undefined symbol: " + Sym->getName());
@@ -296,7 +296,7 @@ Symbol *SymbolTable::addImportThunk(Stri
std::vector<Chunk *> SymbolTable::getChunks() {
std::vector<Chunk *> Res;
- for (ObjectFile *File : ObjectFiles) {
+ for (ObjFile *File : ObjFiles) {
std::vector<Chunk *> &V = File->getChunks();
Res.insert(Res.end(), V.begin(), V.end());
}
@@ -365,9 +365,9 @@ void SymbolTable::addCombinedLTOObjects(
if (BitcodeFiles.empty())
return;
for (StringRef Object : compileBitcodeFiles()) {
- auto *Obj = make<ObjectFile>(MemoryBufferRef(Object, "lto.tmp"));
+ auto *Obj = make<ObjFile>(MemoryBufferRef(Object, "lto.tmp"));
Obj->parse();
- ObjectFiles.push_back(Obj);
+ ObjFiles.push_back(Obj);
}
}
Modified: lld/trunk/COFF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.h?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.h (original)
+++ lld/trunk/COFF/SymbolTable.h Wed Jul 26 16:05:24 2017
@@ -80,7 +80,7 @@ public:
std::vector<ImportFile *> ImportFiles;
// The writer needs to infer the machine type from the object files.
- std::vector<ObjectFile *> ObjectFiles;
+ std::vector<ObjFile *> ObjFiles;
// Creates an Undefined symbol for a given name.
SymbolBody *addUndefined(StringRef Name);
Modified: lld/trunk/COFF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.cpp?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.cpp (original)
+++ lld/trunk/COFF/Symbols.cpp Wed Jul 26 16:05:24 2017
@@ -39,7 +39,7 @@ StringRef SymbolBody::getName() {
// is a waste of time.
if (Name.empty()) {
auto *D = cast<DefinedCOFF>(this);
- cast<ObjectFile>(D->File)->getCOFFObj()->getSymbolName(D->Sym, Name);
+ cast<ObjFile>(D->File)->getCOFFObj()->getSymbolName(D->Sym, Name);
}
return Name;
}
@@ -53,8 +53,7 @@ InputFile *SymbolBody::getFile() {
}
COFFSymbolRef DefinedCOFF::getCOFFSymbol() {
- size_t SymSize =
- cast<ObjectFile>(File)->getCOFFObj()->getSymbolTableEntrySize();
+ size_t SymSize = cast<ObjFile>(File)->getCOFFObj()->getSymbolTableEntrySize();
if (SymSize == sizeof(coff_symbol16))
return COFFSymbolRef(reinterpret_cast<const coff_symbol16 *>(Sym));
assert(SymSize == sizeof(coff_symbol32));
Modified: lld/trunk/COFF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.h?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.h (original)
+++ lld/trunk/COFF/Symbols.h Wed Jul 26 16:05:24 2017
@@ -31,7 +31,7 @@ using llvm::object::coff_symbol_generic;
class ArchiveFile;
class InputFile;
-class ObjectFile;
+class ObjFile;
struct Symbol;
class SymbolTable;
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=309228&r1=309227&r2=309228&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Wed Jul 26 16:05:24 2017
@@ -322,7 +322,7 @@ void Writer::createMiscChunks() {
std::set<Defined *> Handlers;
- for (lld::coff::ObjectFile *File : Symtab->ObjectFiles) {
+ for (ObjFile *File : Symtab->ObjFiles) {
if (!File->SEHCompat)
return;
for (SymbolBody *B : File->SEHandlers) {
@@ -501,7 +501,7 @@ void Writer::createSymbolAndStringTable(
Sec->setStringTableOff(addEntryToStringTable(Name));
}
- for (lld::coff::ObjectFile *File : Symtab->ObjectFiles) {
+ for (ObjFile *File : Symtab->ObjFiles) {
for (SymbolBody *B : File->getSymbols()) {
auto *D = dyn_cast<Defined>(B);
if (!D || D->WrittenToSymtab)
More information about the llvm-commits
mailing list