diff options
Diffstat (limited to 'lld/wasm/InputFiles.h')
-rw-r--r-- | lld/wasm/InputFiles.h | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h index 57d36a8dc2a..2b25906f443 100644 --- a/lld/wasm/InputFiles.h +++ b/lld/wasm/InputFiles.h @@ -35,7 +35,7 @@ class InputSection; // If --reproduce option is given, all input files are written // to this tar archive. -extern std::unique_ptr<llvm::TarWriter> Tar; +extern std::unique_ptr<llvm::TarWriter> tar; class InputFile { public: @@ -49,129 +49,129 @@ public: virtual ~InputFile() {} // Returns the filename. - StringRef getName() const { return MB.getBufferIdentifier(); } + StringRef getName() const { return mb.getBufferIdentifier(); } - Kind kind() const { return FileKind; } + Kind kind() const { return fileKind; } // An archive file name if this file is created from an archive. - StringRef ArchiveName; + StringRef archiveName; - ArrayRef<Symbol *> getSymbols() const { return Symbols; } + ArrayRef<Symbol *> getSymbols() const { return symbols; } - MutableArrayRef<Symbol *> getMutableSymbols() { return Symbols; } + MutableArrayRef<Symbol *> getMutableSymbols() { return symbols; } protected: - InputFile(Kind K, MemoryBufferRef M) : MB(M), FileKind(K) {} - MemoryBufferRef MB; + InputFile(Kind k, MemoryBufferRef m) : mb(m), fileKind(k) {} + MemoryBufferRef mb; // List of all symbols referenced or defined by this file. - std::vector<Symbol *> Symbols; + std::vector<Symbol *> symbols; private: - const Kind FileKind; + const Kind fileKind; }; // .a file (ar archive) class ArchiveFile : public InputFile { public: - explicit ArchiveFile(MemoryBufferRef M) : InputFile(ArchiveKind, M) {} - static bool classof(const InputFile *F) { return F->kind() == ArchiveKind; } + explicit ArchiveFile(MemoryBufferRef m) : InputFile(ArchiveKind, m) {} + static bool classof(const InputFile *f) { return f->kind() == ArchiveKind; } - void addMember(const llvm::object::Archive::Symbol *Sym); + void addMember(const llvm::object::Archive::Symbol *sym); void parse(); private: - std::unique_ptr<llvm::object::Archive> File; - llvm::DenseSet<uint64_t> Seen; + std::unique_ptr<llvm::object::Archive> file; + llvm::DenseSet<uint64_t> seen; }; // .o file (wasm object file) class ObjFile : public InputFile { public: - explicit ObjFile(MemoryBufferRef M, StringRef ArchiveName) - : InputFile(ObjectKind, M) { - this->ArchiveName = ArchiveName; + explicit ObjFile(MemoryBufferRef m, StringRef archiveName) + : InputFile(ObjectKind, m) { + this->archiveName = archiveName; } - static bool classof(const InputFile *F) { return F->kind() == ObjectKind; } + static bool classof(const InputFile *f) { return f->kind() == ObjectKind; } - void parse(bool IgnoreComdats = false); + void parse(bool ignoreComdats = false); // Returns the underlying wasm file. - const WasmObjectFile *getWasmObj() const { return WasmObj.get(); } + const WasmObjectFile *getWasmObj() const { return wasmObj.get(); } void dumpInfo() const; - uint32_t calcNewIndex(const WasmRelocation &Reloc) const; - uint32_t calcNewValue(const WasmRelocation &Reloc) const; - uint32_t calcNewAddend(const WasmRelocation &Reloc) const; - uint32_t calcExpectedValue(const WasmRelocation &Reloc) const; - Symbol *getSymbol(const WasmRelocation &Reloc) const { - return Symbols[Reloc.Index]; + uint32_t calcNewIndex(const WasmRelocation &reloc) const; + uint32_t calcNewValue(const WasmRelocation &reloc) const; + uint32_t calcNewAddend(const WasmRelocation &reloc) const; + uint32_t calcExpectedValue(const WasmRelocation &reloc) const; + Symbol *getSymbol(const WasmRelocation &reloc) const { + return symbols[reloc.Index]; }; - const WasmSection *CodeSection = nullptr; - const WasmSection *DataSection = nullptr; + const WasmSection *codeSection = nullptr; + const WasmSection *dataSection = nullptr; // Maps input type indices to output type indices - std::vector<uint32_t> TypeMap; - std::vector<bool> TypeIsUsed; + std::vector<uint32_t> typeMap; + std::vector<bool> typeIsUsed; // Maps function indices to table indices - std::vector<uint32_t> TableEntries; - std::vector<bool> KeptComdats; - std::vector<InputSegment *> Segments; - std::vector<InputFunction *> Functions; - std::vector<InputGlobal *> Globals; - std::vector<InputEvent *> Events; - std::vector<InputSection *> CustomSections; - llvm::DenseMap<uint32_t, InputSection *> CustomSectionsByIndex; - - Symbol *getSymbol(uint32_t Index) const { return Symbols[Index]; } - FunctionSymbol *getFunctionSymbol(uint32_t Index) const; - DataSymbol *getDataSymbol(uint32_t Index) const; - GlobalSymbol *getGlobalSymbol(uint32_t Index) const; - SectionSymbol *getSectionSymbol(uint32_t Index) const; - EventSymbol *getEventSymbol(uint32_t Index) const; + std::vector<uint32_t> tableEntries; + std::vector<bool> keptComdats; + std::vector<InputSegment *> segments; + std::vector<InputFunction *> functions; + std::vector<InputGlobal *> globals; + std::vector<InputEvent *> events; + std::vector<InputSection *> customSections; + llvm::DenseMap<uint32_t, InputSection *> customSectionsByIndex; + + Symbol *getSymbol(uint32_t index) const { return symbols[index]; } + FunctionSymbol *getFunctionSymbol(uint32_t index) const; + DataSymbol *getDataSymbol(uint32_t index) const; + GlobalSymbol *getGlobalSymbol(uint32_t index) const; + SectionSymbol *getSectionSymbol(uint32_t index) const; + EventSymbol *getEventSymbol(uint32_t index) const; private: - Symbol *createDefined(const WasmSymbol &Sym); - Symbol *createUndefined(const WasmSymbol &Sym, bool IsCalledDirectly); + Symbol *createDefined(const WasmSymbol &sym); + Symbol *createUndefined(const WasmSymbol &sym, bool isCalledDirectly); - bool isExcludedByComdat(InputChunk *Chunk) const; + bool isExcludedByComdat(InputChunk *chunk) const; - std::unique_ptr<WasmObjectFile> WasmObj; + std::unique_ptr<WasmObjectFile> wasmObj; }; // .so file. class SharedFile : public InputFile { public: - explicit SharedFile(MemoryBufferRef M) : InputFile(SharedKind, M) {} - static bool classof(const InputFile *F) { return F->kind() == SharedKind; } + explicit SharedFile(MemoryBufferRef m) : InputFile(SharedKind, m) {} + static bool classof(const InputFile *f) { return f->kind() == SharedKind; } }; // .bc file class BitcodeFile : public InputFile { public: - explicit BitcodeFile(MemoryBufferRef M, StringRef ArchiveName) - : InputFile(BitcodeKind, M) { - this->ArchiveName = ArchiveName; + explicit BitcodeFile(MemoryBufferRef m, StringRef archiveName) + : InputFile(BitcodeKind, m) { + this->archiveName = archiveName; } - static bool classof(const InputFile *F) { return F->kind() == BitcodeKind; } + static bool classof(const InputFile *f) { return f->kind() == BitcodeKind; } void parse(); - std::unique_ptr<llvm::lto::InputFile> Obj; + std::unique_ptr<llvm::lto::InputFile> obj; }; // Will report a fatal() error if the input buffer is not a valid bitcode // or wasm object file. -InputFile *createObjectFile(MemoryBufferRef MB, StringRef ArchiveName = ""); +InputFile *createObjectFile(MemoryBufferRef mb, StringRef archiveName = ""); // Opens a given file. -llvm::Optional<MemoryBufferRef> readFile(StringRef Path); +llvm::Optional<MemoryBufferRef> readFile(StringRef path); } // namespace wasm -std::string toString(const wasm::InputFile *File); +std::string toString(const wasm::InputFile *file); } // namespace lld |