summaryrefslogtreecommitdiffstats
path: root/lld/COFF/InputFiles.h
diff options
context:
space:
mode:
Diffstat (limited to 'lld/COFF/InputFiles.h')
-rw-r--r--lld/COFF/InputFiles.h182
1 files changed, 91 insertions, 91 deletions
diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h
index 22017f78013..bd2698f4761 100644
--- a/lld/COFF/InputFiles.h
+++ b/lld/COFF/InputFiles.h
@@ -32,7 +32,7 @@ class DbiModuleDescriptorBuilder;
namespace lld {
namespace coff {
-std::vector<MemoryBufferRef> getArchiveMembers(llvm::object::Archive *File);
+std::vector<MemoryBufferRef> getArchiveMembers(llvm::object::Archive *file);
using llvm::COFF::IMAGE_FILE_MACHINE_UNKNOWN;
using llvm::COFF::MachineTypes;
@@ -57,11 +57,11 @@ class TpiSource;
class InputFile {
public:
enum Kind { ArchiveKind, ObjectKind, ImportKind, BitcodeKind };
- Kind kind() const { return FileKind; }
+ Kind kind() const { return fileKind; }
virtual ~InputFile() {}
// Returns the filename.
- StringRef getName() const { return MB.getBufferIdentifier(); }
+ StringRef getName() const { return mb.getBufferIdentifier(); }
// Reads a file (the constructor doesn't do that).
virtual void parse() = 0;
@@ -69,118 +69,118 @@ public:
// Returns the CPU type this file was compiled to.
virtual MachineTypes getMachineType() { return IMAGE_FILE_MACHINE_UNKNOWN; }
- MemoryBufferRef MB;
+ MemoryBufferRef mb;
// An archive file name if this file is created from an archive.
- StringRef ParentName;
+ StringRef parentName;
// Returns .drectve section contents if exist.
- StringRef getDirectives() { return Directives; }
+ StringRef getDirectives() { return directives; }
protected:
- InputFile(Kind K, MemoryBufferRef M) : MB(M), FileKind(K) {}
+ InputFile(Kind k, MemoryBufferRef m) : mb(m), fileKind(k) {}
- StringRef Directives;
+ StringRef directives;
private:
- const Kind FileKind;
+ const Kind fileKind;
};
// .lib or .a file.
class ArchiveFile : public InputFile {
public:
- explicit ArchiveFile(MemoryBufferRef M);
- static bool classof(const InputFile *F) { return F->kind() == ArchiveKind; }
+ explicit ArchiveFile(MemoryBufferRef m);
+ static bool classof(const InputFile *f) { return f->kind() == ArchiveKind; }
void parse() override;
// Enqueues an archive member load for the given symbol. If we've already
// enqueued a load for the same archive member, this function does nothing,
// which ensures that we don't load the same member more than once.
- void addMember(const Archive::Symbol *Sym);
+ void addMember(const Archive::Symbol *sym);
private:
- std::unique_ptr<Archive> File;
- llvm::DenseSet<uint64_t> Seen;
+ std::unique_ptr<Archive> file;
+ llvm::DenseSet<uint64_t> seen;
};
// .obj or .o file. This may be a member of an archive file.
class ObjFile : public InputFile {
public:
- explicit ObjFile(MemoryBufferRef M) : InputFile(ObjectKind, M) {}
- static bool classof(const InputFile *F) { return F->kind() == ObjectKind; }
+ explicit ObjFile(MemoryBufferRef m) : InputFile(ObjectKind, m) {}
+ static bool classof(const InputFile *f) { return f->kind() == ObjectKind; }
void parse() override;
MachineTypes getMachineType() override;
- ArrayRef<Chunk *> getChunks() { return Chunks; }
- ArrayRef<SectionChunk *> getDebugChunks() { return DebugChunks; }
- ArrayRef<SectionChunk *> getSXDataChunks() { return SXDataChunks; }
- ArrayRef<SectionChunk *> getGuardFidChunks() { return GuardFidChunks; }
- ArrayRef<SectionChunk *> getGuardLJmpChunks() { return GuardLJmpChunks; }
- ArrayRef<Symbol *> getSymbols() { return Symbols; }
+ ArrayRef<Chunk *> getChunks() { return chunks; }
+ ArrayRef<SectionChunk *> getDebugChunks() { return debugChunks; }
+ ArrayRef<SectionChunk *> getSXDataChunks() { return sXDataChunks; }
+ ArrayRef<SectionChunk *> getGuardFidChunks() { return guardFidChunks; }
+ ArrayRef<SectionChunk *> getGuardLJmpChunks() { return guardLJmpChunks; }
+ ArrayRef<Symbol *> getSymbols() { return symbols; }
- ArrayRef<uint8_t> getDebugSection(StringRef SecName);
+ ArrayRef<uint8_t> getDebugSection(StringRef secName);
// Returns a Symbol object for the SymbolIndex'th symbol in the
// underlying object file.
- Symbol *getSymbol(uint32_t SymbolIndex) {
- return Symbols[SymbolIndex];
+ Symbol *getSymbol(uint32_t symbolIndex) {
+ return symbols[symbolIndex];
}
// Returns the underlying COFF file.
- COFFObjectFile *getCOFFObj() { return COFFObj.get(); }
+ COFFObjectFile *getCOFFObj() { return coffObj.get(); }
// Add a symbol for a range extension thunk. Return the new symbol table
// index. This index can be used to modify a relocation.
- uint32_t addRangeThunkSymbol(Symbol *Thunk) {
- Symbols.push_back(Thunk);
- return Symbols.size() - 1;
+ uint32_t addRangeThunkSymbol(Symbol *thunk) {
+ symbols.push_back(thunk);
+ return symbols.size() - 1;
}
- static std::vector<ObjFile *> Instances;
+ static std::vector<ObjFile *> instances;
// Flags in the absolute @feat.00 symbol if it is present. These usually
// indicate if an object was compiled with certain security features enabled
// like stack guard, safeseh, /guard:cf, or other things.
- uint32_t Feat00Flags = 0;
+ uint32_t feat00Flags = 0;
// True if this object file is compatible with SEH. COFF-specific and
// x86-only. COFF spec 5.10.1. The .sxdata section.
- bool hasSafeSEH() { return Feat00Flags & 0x1; }
+ bool hasSafeSEH() { return feat00Flags & 0x1; }
// True if this file was compiled with /guard:cf.
- bool hasGuardCF() { return Feat00Flags & 0x800; }
+ bool hasGuardCF() { return feat00Flags & 0x800; }
// Pointer to the PDB module descriptor builder. Various debug info records
// will reference object files by "module index", which is here. Things like
// source files and section contributions are also recorded here. Will be null
// if we are not producing a PDB.
- llvm::pdb::DbiModuleDescriptorBuilder *ModuleDBI = nullptr;
+ llvm::pdb::DbiModuleDescriptorBuilder *moduleDBI = nullptr;
- const coff_section *AddrsigSec = nullptr;
+ const coff_section *addrsigSec = nullptr;
// When using Microsoft precompiled headers, this is the PCH's key.
// The same key is used by both the precompiled object, and objects using the
// precompiled object. Any difference indicates out-of-date objects.
- llvm::Optional<uint32_t> PCHSignature;
+ llvm::Optional<uint32_t> pchSignature;
// Whether this is an object file created from .res files.
- bool IsResourceObjFile = false;
+ bool isResourceObjFile = false;
// Whether this file was compiled with /hotpatch.
- bool HotPatchable = false;
+ bool hotPatchable = false;
// Whether the object was already merged into the final PDB.
- bool MergedIntoPDB = false;
+ bool mergedIntoPDB = false;
// If the OBJ has a .debug$T stream, this tells how it will be handled.
- TpiSource *DebugTypesObj = nullptr;
+ TpiSource *debugTypesObj = nullptr;
// The .debug$T stream if there's one.
- llvm::Optional<llvm::codeview::CVTypeArray> DebugTypes;
+ llvm::Optional<llvm::codeview::CVTypeArray> debugTypes;
private:
- const coff_section* getSection(uint32_t I);
- const coff_section *getSection(COFFSymbolRef Sym) {
- return getSection(Sym.getSectionNumber());
+ const coff_section* getSection(uint32_t i);
+ const coff_section *getSection(COFFSymbolRef sym) {
+ return getSection(sym.getSectionNumber());
}
void initializeChunks();
@@ -189,26 +189,26 @@ private:
void initializeDependencies();
SectionChunk *
- readSection(uint32_t SectionNumber,
- const llvm::object::coff_aux_section_definition *Def,
- StringRef LeaderName);
+ readSection(uint32_t sectionNumber,
+ const llvm::object::coff_aux_section_definition *def,
+ StringRef leaderName);
void readAssociativeDefinition(
- COFFSymbolRef COFFSym,
- const llvm::object::coff_aux_section_definition *Def);
+ COFFSymbolRef coffSym,
+ const llvm::object::coff_aux_section_definition *def);
void readAssociativeDefinition(
- COFFSymbolRef COFFSym,
- const llvm::object::coff_aux_section_definition *Def,
- uint32_t ParentSection);
+ COFFSymbolRef coffSym,
+ const llvm::object::coff_aux_section_definition *def,
+ uint32_t parentSection);
void recordPrevailingSymbolForMingw(
- COFFSymbolRef COFFSym,
- llvm::DenseMap<StringRef, uint32_t> &PrevailingSectionMap);
+ COFFSymbolRef coffSym,
+ llvm::DenseMap<StringRef, uint32_t> &prevailingSectionMap);
void maybeAssociateSEHForMingw(
- COFFSymbolRef Sym, const llvm::object::coff_aux_section_definition *Def,
- const llvm::DenseMap<StringRef, uint32_t> &PrevailingSectionMap);
+ COFFSymbolRef sym, const llvm::object::coff_aux_section_definition *def,
+ const llvm::DenseMap<StringRef, uint32_t> &prevailingSectionMap);
// Given a new symbol Sym with comdat selection Selection, if the new
// symbol is not (yet) Prevailing and the existing comdat leader set to
@@ -216,48 +216,48 @@ private:
// match the existing symbol and its selection. If either old or new
// symbol have selection IMAGE_COMDAT_SELECT_LARGEST, Sym might replace
// the existing leader. In that case, Prevailing is set to true.
- void handleComdatSelection(COFFSymbolRef Sym,
- llvm::COFF::COMDATType &Selection,
- bool &Prevailing, DefinedRegular *Leader);
+ void handleComdatSelection(COFFSymbolRef sym,
+ llvm::COFF::COMDATType &selection,
+ bool &prevailing, DefinedRegular *leader);
llvm::Optional<Symbol *>
- createDefined(COFFSymbolRef Sym,
+ createDefined(COFFSymbolRef sym,
std::vector<const llvm::object::coff_aux_section_definition *>
- &ComdatDefs,
- bool &PrevailingComdat);
- Symbol *createRegular(COFFSymbolRef Sym);
- Symbol *createUndefined(COFFSymbolRef Sym);
+ &comdatDefs,
+ bool &prevailingComdat);
+ Symbol *createRegular(COFFSymbolRef sym);
+ Symbol *createUndefined(COFFSymbolRef sym);
- std::unique_ptr<COFFObjectFile> COFFObj;
+ std::unique_ptr<COFFObjectFile> coffObj;
// List of all chunks defined by this file. This includes both section
// chunks and non-section chunks for common symbols.
- std::vector<Chunk *> Chunks;
+ std::vector<Chunk *> chunks;
// CodeView debug info sections.
- std::vector<SectionChunk *> DebugChunks;
+ std::vector<SectionChunk *> debugChunks;
// Chunks containing symbol table indices of exception handlers. Only used for
// 32-bit x86.
- std::vector<SectionChunk *> SXDataChunks;
+ std::vector<SectionChunk *> sXDataChunks;
// Chunks containing symbol table indices of address taken symbols and longjmp
// targets. These are not linked into the final binary when /guard:cf is set.
- std::vector<SectionChunk *> GuardFidChunks;
- std::vector<SectionChunk *> GuardLJmpChunks;
+ std::vector<SectionChunk *> guardFidChunks;
+ std::vector<SectionChunk *> guardLJmpChunks;
// This vector contains the same chunks as Chunks, but they are
// indexed such that you can get a SectionChunk by section index.
// Nonexistent section indices are filled with null pointers.
// (Because section number is 1-based, the first slot is always a
// null pointer.)
- std::vector<SectionChunk *> SparseChunks;
+ std::vector<SectionChunk *> sparseChunks;
// This vector contains a list of all symbols defined or referenced by this
// file. They are indexed such that you can get a Symbol by symbol
// index. Nonexistent indices (which are occupied by auxiliary
// symbols in the real symbol table) are filled with null pointers.
- std::vector<Symbol *> Symbols;
+ std::vector<Symbol *> symbols;
};
// This type represents import library members that contain DLL names
@@ -265,23 +265,23 @@ private:
// for details about the format.
class ImportFile : public InputFile {
public:
- explicit ImportFile(MemoryBufferRef M) : InputFile(ImportKind, M) {}
+ explicit ImportFile(MemoryBufferRef m) : InputFile(ImportKind, m) {}
- static bool classof(const InputFile *F) { return F->kind() == ImportKind; }
+ static bool classof(const InputFile *f) { return f->kind() == ImportKind; }
- static std::vector<ImportFile *> Instances;
+ static std::vector<ImportFile *> instances;
- Symbol *ImpSym = nullptr;
- Symbol *ThunkSym = nullptr;
- std::string DLLName;
+ Symbol *impSym = nullptr;
+ Symbol *thunkSym = nullptr;
+ std::string dllName;
private:
void parse() override;
public:
- StringRef ExternalName;
- const coff_import_header *Hdr;
- Chunk *Location = nullptr;
+ StringRef externalName;
+ const coff_import_header *hdr;
+ Chunk *location = nullptr;
// We want to eliminate dllimported symbols if no one actually refers them.
// These "Live" bits are used to keep track of which import library members
@@ -291,29 +291,29 @@ public:
// symbols provided by this import library member. We also track whether the
// imported symbol is used separately from whether the thunk is used in order
// to avoid creating unnecessary thunks.
- bool Live = !Config->DoGC;
- bool ThunkLive = !Config->DoGC;
+ bool live = !config->doGC;
+ bool thunkLive = !config->doGC;
};
// Used for LTO.
class BitcodeFile : public InputFile {
public:
- BitcodeFile(MemoryBufferRef MB, StringRef ArchiveName,
- uint64_t OffsetInArchive);
- static bool classof(const InputFile *F) { return F->kind() == BitcodeKind; }
- ArrayRef<Symbol *> getSymbols() { return Symbols; }
+ BitcodeFile(MemoryBufferRef mb, StringRef archiveName,
+ uint64_t offsetInArchive);
+ static bool classof(const InputFile *f) { return f->kind() == BitcodeKind; }
+ ArrayRef<Symbol *> getSymbols() { return symbols; }
MachineTypes getMachineType() override;
- static std::vector<BitcodeFile *> Instances;
- std::unique_ptr<llvm::lto::InputFile> Obj;
+ static std::vector<BitcodeFile *> instances;
+ std::unique_ptr<llvm::lto::InputFile> obj;
private:
void parse() override;
- std::vector<Symbol *> Symbols;
+ std::vector<Symbol *> symbols;
};
} // namespace coff
-std::string toString(const coff::InputFile *File);
+std::string toString(const coff::InputFile *file);
} // namespace lld
#endif
OpenPOWER on IntegriCloud