diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/DWARFLinker/DWARFLinker.h | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/DWARFLinker/DWARFLinker.h')
-rw-r--r-- | contrib/libs/llvm12/include/llvm/DWARFLinker/DWARFLinker.h | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/contrib/libs/llvm12/include/llvm/DWARFLinker/DWARFLinker.h b/contrib/libs/llvm12/include/llvm/DWARFLinker/DWARFLinker.h index f6007dfbec..fdc8be13fb 100644 --- a/contrib/libs/llvm12/include/llvm/DWARFLinker/DWARFLinker.h +++ b/contrib/libs/llvm12/include/llvm/DWARFLinker/DWARFLinker.h @@ -71,18 +71,18 @@ public: /// section. Reset current relocation pointer if neccessary. virtual bool hasValidRelocs(bool ResetRelocsPtr = true) = 0; - /// Checks that the specified DIE has a DW_AT_Location attribute - /// that references into a live code section. This function - /// must be called with DIE offsets in strictly ascending order. - virtual bool hasLiveMemoryLocation(const DWARFDie &DIE, - CompileUnit::DIEInfo &Info) = 0; - - /// Checks that the specified DIE has a DW_AT_Low_pc attribute - /// that references into a live code section. This function - /// must be called with DIE offsets in strictly ascending order. - virtual bool hasLiveAddressRange(const DWARFDie &DIE, - CompileUnit::DIEInfo &Info) = 0; - + /// Checks that the specified DIE has a DW_AT_Location attribute + /// that references into a live code section. This function + /// must be called with DIE offsets in strictly ascending order. + virtual bool hasLiveMemoryLocation(const DWARFDie &DIE, + CompileUnit::DIEInfo &Info) = 0; + + /// Checks that the specified DIE has a DW_AT_Low_pc attribute + /// that references into a live code section. This function + /// must be called with DIE offsets in strictly ascending order. + virtual bool hasLiveAddressRange(const DWARFDie &DIE, + CompileUnit::DIEInfo &Info) = 0; + /// Apply the valid relocations to the buffer \p Data, taking into /// account that Data is at \p BaseOffset in the debug_info section. /// @@ -92,9 +92,9 @@ public: virtual bool applyValidRelocs(MutableArrayRef<char> Data, uint64_t BaseOffset, bool IsLittleEndian) = 0; - /// Relocate the given address offset if a valid relocation exists. - virtual llvm::Expected<uint64_t> relocateIndexedAddr(uint64_t Offset) = 0; - + /// Relocate the given address offset if a valid relocation exists. + virtual llvm::Expected<uint64_t> relocateIndexedAddr(uint64_t Offset) = 0; + /// Returns all valid functions address ranges(i.e., those ranges /// which points to sections with code). virtual RangesTy &getValidAddressRanges() = 0; @@ -193,8 +193,8 @@ public: /// /// As a side effect, this also switches the current Dwarf version /// of the MC layer to the one of U.getOrigUnit(). - virtual void emitCompileUnitHeader(CompileUnit &Unit, - unsigned DwarfVersion) = 0; + virtual void emitCompileUnitHeader(CompileUnit &Unit, + unsigned DwarfVersion) = 0; /// Recursively emit the DIE tree rooted at \p Die. virtual void emitDIE(DIE &Die) = 0; @@ -216,9 +216,9 @@ using UnitListTy = std::vector<std::unique_ptr<CompileUnit>>; /// this class represents DWARF information for source file /// and it`s address map. -class DWARFFile { +class DWARFFile { public: - DWARFFile(StringRef Name, DWARFContext *Dwarf, AddressesMap *Addresses, + DWARFFile(StringRef Name, DWARFContext *Dwarf, AddressesMap *Addresses, const std::vector<std::string> &Warnings) : FileName(Name), Dwarf(Dwarf), Addresses(Addresses), Warnings(Warnings) { } @@ -236,7 +236,7 @@ public: typedef std::function<void(const Twine &Warning, StringRef Context, const DWARFDie *DIE)> messageHandler; -typedef std::function<ErrorOr<DWARFFile &>(StringRef ContainerName, +typedef std::function<ErrorOr<DWARFFile &>(StringRef ContainerName, StringRef Path)> objFileLoader; typedef std::map<std::string, std::string> swiftInterfacesMap; @@ -263,7 +263,7 @@ public: : TheDwarfEmitter(Emitter), DwarfLinkerClientID(ClientID) {} /// Add object file to be linked. - void addObjectFile(DWARFFile &File); + void addObjectFile(DWARFFile &File); /// Link debug info for added objFiles. Object /// files are linked all together. @@ -367,38 +367,38 @@ private: /// of work needs to be performed when processing the current item. The flags /// and info fields are optional based on the type. struct WorklistItem { - DWARFDie Die; + DWARFDie Die; WorklistItemType Type; CompileUnit &CU; unsigned Flags; - union { - const unsigned AncestorIdx; - CompileUnit::DIEInfo *OtherInfo; - }; + union { + const unsigned AncestorIdx; + CompileUnit::DIEInfo *OtherInfo; + }; WorklistItem(DWARFDie Die, CompileUnit &CU, unsigned Flags, WorklistItemType T = WorklistItemType::LookForDIEsToKeep) - : Die(Die), Type(T), CU(CU), Flags(Flags), AncestorIdx(0) {} + : Die(Die), Type(T), CU(CU), Flags(Flags), AncestorIdx(0) {} WorklistItem(DWARFDie Die, CompileUnit &CU, WorklistItemType T, CompileUnit::DIEInfo *OtherInfo = nullptr) - : Die(Die), Type(T), CU(CU), Flags(0), OtherInfo(OtherInfo) {} + : Die(Die), Type(T), CU(CU), Flags(0), OtherInfo(OtherInfo) {} WorklistItem(unsigned AncestorIdx, CompileUnit &CU, unsigned Flags) - : Die(), Type(WorklistItemType::LookForParentDIEsToKeep), CU(CU), - Flags(Flags), AncestorIdx(AncestorIdx) {} + : Die(), Type(WorklistItemType::LookForParentDIEsToKeep), CU(CU), + Flags(Flags), AncestorIdx(AncestorIdx) {} }; /// returns true if we need to translate strings. bool needToTranslateStrings() { return StringsTranslator != nullptr; } - void reportWarning(const Twine &Warning, const DWARFFile &File, + void reportWarning(const Twine &Warning, const DWARFFile &File, const DWARFDie *DIE = nullptr) const { if (Options.WarningHandler != nullptr) Options.WarningHandler(Warning, File.FileName, DIE); } - void reportError(const Twine &Warning, const DWARFFile &File, + void reportError(const Twine &Warning, const DWARFFile &File, const DWARFDie *DIE = nullptr) const { if (Options.ErrorHandler != nullptr) Options.ErrorHandler(Warning, File.FileName, DIE); @@ -414,18 +414,18 @@ private: void updateAccelKind(DWARFContext &Dwarf); /// Emit warnings as Dwarf compile units to leave a trail after linking. - bool emitPaperTrailWarnings(const DWARFFile &File, + bool emitPaperTrailWarnings(const DWARFFile &File, OffsetsStringPool &StringPool); void copyInvariantDebugSection(DWARFContext &Dwarf); /// Keeps track of data associated with one object during linking. struct LinkContext { - DWARFFile &File; + DWARFFile &File; UnitListTy CompileUnits; bool Skip = false; - LinkContext(DWARFFile &File) : File(File) {} + LinkContext(DWARFFile &File) : File(File) {} /// Clear part of the context that's no longer needed when we're done with /// the debug object. @@ -454,7 +454,7 @@ private: /// kept. All DIEs referenced though attributes should be kept. void lookForRefDIEsToKeep(const DWARFDie &Die, CompileUnit &CU, unsigned Flags, const UnitListTy &Units, - const DWARFFile &File, + const DWARFFile &File, SmallVectorImpl<WorklistItem> &Worklist); /// \defgroup FindRootDIEs Find DIEs corresponding to Address map entries. @@ -466,7 +466,7 @@ private: /// The return value indicates whether the DIE is incomplete. void lookForDIEsToKeep(AddressesMap &RelocMgr, RangesTy &Ranges, const UnitListTy &Units, const DWARFDie &DIE, - const DWARFFile &File, CompileUnit &CU, + const DWARFFile &File, CompileUnit &CU, unsigned Flags); /// If this compile unit is really a skeleton CU that points to a @@ -476,7 +476,7 @@ private: /// pointing to the module, and a DW_AT_gnu_dwo_id with the module /// hash. bool registerModuleReference(DWARFDie CUDie, const DWARFUnit &Unit, - const DWARFFile &File, + const DWARFFile &File, OffsetsStringPool &OffsetsStringPool, DeclContextTree &ODRContexts, uint64_t ModulesEndOffset, unsigned &UnitID, @@ -488,7 +488,7 @@ private: /// to Units. Error loadClangModule(DWARFDie CUDie, StringRef FilePath, StringRef ModuleName, uint64_t DwoId, - const DWARFFile &File, + const DWARFFile &File, OffsetsStringPool &OffsetsStringPool, DeclContextTree &ODRContexts, uint64_t ModulesEndOffset, unsigned &UnitID, bool IsLittleEndian, @@ -498,11 +498,11 @@ private: void keepDIEAndDependencies(AddressesMap &RelocMgr, RangesTy &Ranges, const UnitListTy &Units, const DWARFDie &DIE, CompileUnit::DIEInfo &MyInfo, - const DWARFFile &File, CompileUnit &CU, + const DWARFFile &File, CompileUnit &CU, bool UseODR); unsigned shouldKeepDIE(AddressesMap &RelocMgr, RangesTy &Ranges, - const DWARFDie &DIE, const DWARFFile &File, + const DWARFDie &DIE, const DWARFFile &File, CompileUnit &Unit, CompileUnit::DIEInfo &MyInfo, unsigned Flags); @@ -512,7 +512,7 @@ private: CompileUnit::DIEInfo &MyInfo, unsigned Flags); unsigned shouldKeepSubprogramDIE(AddressesMap &RelocMgr, RangesTy &Ranges, - const DWARFDie &DIE, const DWARFFile &File, + const DWARFDie &DIE, const DWARFFile &File, CompileUnit &Unit, CompileUnit::DIEInfo &MyInfo, unsigned Flags); @@ -521,7 +521,7 @@ private: /// RefValue. The resulting DIE might be in another CompileUnit which is /// stored into \p ReferencedCU. \returns null if resolving fails for any /// reason. - DWARFDie resolveDIEReference(const DWARFFile &File, const UnitListTy &Units, + DWARFDie resolveDIEReference(const DWARFFile &File, const UnitListTy &Units, const DWARFFormValue &RefValue, const DWARFDie &DIE, CompileUnit *&RefCU); @@ -536,7 +536,7 @@ private: class DIECloner { DWARFLinker &Linker; DwarfEmitter *Emitter; - DWARFFile &ObjFile; + DWARFFile &ObjFile; /// Allocator used for all the DIEValue objects. BumpPtrAllocator &DIEAlloc; @@ -546,7 +546,7 @@ private: bool Update; public: - DIECloner(DWARFLinker &Linker, DwarfEmitter *Emitter, DWARFFile &ObjFile, + DIECloner(DWARFLinker &Linker, DwarfEmitter *Emitter, DWARFFile &ObjFile, BumpPtrAllocator &DIEAlloc, std::vector<std::unique_ptr<CompileUnit>> &CompileUnits, bool Update) @@ -564,7 +564,7 @@ private: /// applied to the entry point of the function to get the linked address. /// \param Die the output DIE to use, pass NULL to create one. /// \returns the root of the cloned tree or null if nothing was selected. - DIE *cloneDIE(const DWARFDie &InputDIE, const DWARFFile &File, + DIE *cloneDIE(const DWARFDie &InputDIE, const DWARFFile &File, CompileUnit &U, OffsetsStringPool &StringPool, int64_t PCOffset, uint32_t OutOffset, unsigned Flags, bool IsLittleEndian, DIE *Die = nullptr); @@ -573,7 +573,7 @@ private: /// chose to keep above. If there are no valid relocs, then there's /// nothing to clone/emit. uint64_t cloneAllCompileUnits(DWARFContext &DwarfContext, - const DWARFFile &File, + const DWARFFile &File, OffsetsStringPool &StringPool, bool IsLittleEndian); @@ -619,7 +619,7 @@ private: /// Helper for cloneDIE. unsigned cloneAttribute(DIE &Die, const DWARFDie &InputDIE, - const DWARFFile &File, CompileUnit &U, + const DWARFFile &File, CompileUnit &U, OffsetsStringPool &StringPool, const DWARFFormValue &Val, const AttributeSpec AttrSpec, unsigned AttrSize, @@ -640,18 +640,18 @@ private: AttributeSpec AttrSpec, unsigned AttrSize, const DWARFFormValue &Val, - const DWARFFile &File, + const DWARFFile &File, CompileUnit &Unit); /// Clone a DWARF expression that may be referencing another DIE. void cloneExpression(DataExtractor &Data, DWARFExpression Expression, - const DWARFFile &File, CompileUnit &Unit, + const DWARFFile &File, CompileUnit &Unit, SmallVectorImpl<uint8_t> &OutputBuffer); /// Clone an attribute referencing another DIE and add /// it to \p Die. /// \returns the size of the new attribute. - unsigned cloneBlockAttribute(DIE &Die, const DWARFFile &File, + unsigned cloneBlockAttribute(DIE &Die, const DWARFFile &File, CompileUnit &Unit, AttributeSpec AttrSpec, const DWARFFormValue &Val, unsigned AttrSize, bool IsLittleEndian); @@ -667,7 +667,7 @@ private: /// Clone a scalar attribute and add it to \p Die. /// \returns the size of the new attribute. unsigned cloneScalarAttribute(DIE &Die, const DWARFDie &InputDIE, - const DWARFFile &File, CompileUnit &U, + const DWARFFile &File, CompileUnit &U, AttributeSpec AttrSpec, const DWARFFormValue &Val, unsigned AttrSize, AttributesInfo &Info); @@ -683,7 +683,7 @@ private: void copyAbbrev(const DWARFAbbreviationDeclaration &Abbrev, bool hasODR); uint32_t hashFullyQualifiedName(DWARFDie DIE, CompileUnit &U, - const DWARFFile &File, + const DWARFFile &File, int RecurseDepth = 0); /// Helper for cloneDIE. @@ -698,7 +698,7 @@ private: /// Compute and emit debug_ranges section for \p Unit, and /// patch the attributes referencing it. void patchRangesForUnit(const CompileUnit &Unit, DWARFContext &Dwarf, - const DWARFFile &File) const; + const DWARFFile &File) const; /// Generate and emit the DW_AT_ranges attribute for a compile_unit if it had /// one. @@ -708,7 +708,7 @@ private: /// parts according to the linked function ranges and emit the result in the /// debug_line section. void patchLineTableForUnit(CompileUnit &Unit, DWARFContext &OrigDwarf, - const DWARFFile &File); + const DWARFFile &File); /// Emit the accelerator entries for \p Unit. void emitAcceleratorEntriesForUnit(CompileUnit &Unit); @@ -716,7 +716,7 @@ private: void emitAppleAcceleratorEntriesForUnit(CompileUnit &Unit); /// Patch the frame info for an object file and emit it. - void patchFrameInfoForObject(const DWARFFile &, RangesTy &Ranges, + void patchFrameInfoForObject(const DWARFFile &, RangesTy &Ranges, DWARFContext &, unsigned AddressSize); /// FoldingSet that uniques the abbreviations. |