9 #ifndef LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H 10 #define LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H 21 template <
typename KeyT,
typename ValT>
23 IntervalMap<KeyT, ValT, IntervalMapImpl::NodeSizer<KeyT, ValT>::LeafSize,
35 void set(uint64_t New)
const {
38 assert(Old.getType() == DIEValue::isInteger);
42 uint64_t
get()
const {
44 return I->getDIEInteger().getValue();
81 : OrigUnit(OrigUnit), ID(ID), Ranges(RangeAlloc),
82 ClangModuleName(ClangModuleName) {
91 HasODR = CanUseODR && (*Lang == dwarf::DW_LANG_C_plus_plus ||
92 *Lang == dwarf::DW_LANG_C_plus_plus_03 ||
93 *Lang == dwarf::DW_LANG_C_plus_plus_11 ||
94 *Lang == dwarf::DW_LANG_C_plus_plus_14 ||
95 *Lang == dwarf::DW_LANG_ObjC_plus_plus);
108 return &const_cast<BasicDIEUnit &>(*NewUnit).
getUnitDie();
137 return UnitRangeAttribute;
143 return RangeAttributes;
146 const std::vector<std::pair<PatchLocation, int64_t>> &
148 return LocationAttributes;
194 bool SkipPubnamesSection =
false);
200 bool SkipPubnamesSection =
false);
205 bool ObjcClassImplementation,
235 const std::vector<AccelInfo> &
getPubnames()
const {
return Pubnames; }
236 const std::vector<AccelInfo> &
getPubtypes()
const {
return Pubtypes; }
238 const std::vector<AccelInfo> &
getObjC()
const {
return ObjC; }
246 std::vector<DIEInfo> Info;
250 uint64_t StartOffset;
251 uint64_t NextUnitOffset;
263 std::tuple<DIE *, const CompileUnit *, DeclContext *, PatchLocation>>
264 ForwardDIEReferences;
279 std::vector<PatchLocation> RangeAttributes;
287 std::vector<std::pair<PatchLocation, int64_t>> LocationAttributes;
292 std::vector<AccelInfo> Pubnames;
293 std::vector<AccelInfo> Pubtypes;
294 std::vector<AccelInfo> Namespaces;
295 std::vector<AccelInfo> ObjC;
302 bool HasInterestingContent;
311 std::string ClangModuleName;
316 #endif // LLVM_DWARFLINKER_DWARFLINKERCOMPILEUNIT_H A DeclContext is a named program scope that is used for ODR uniquing of types.
MCSymbol * getLabelBegin()
This class represents lattice values for constants.
void setLabelBegin(MCSymbol *S)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
uint64_t getLowPc() const
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, bool SkipPubSection=false)
bool hasLabelAt(uint64_t Addr) const
Stores all information relating to a compile unit, be it in its original instance in the object file ...
void markEverythingAsKept()
Mark every DIE in this unit as kept.
void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name)
Add a name accelerator entry for Die with Name.
bool SkipPubSection
Emit this entry only in the apple_* sections.
uint64_t getNextUnitOffset() const
bool InDebugMap
Was this DIE's entity found in the map?
void set(uint64_t New) const
int64_t AddrAdjust
Address offset to apply to the described entity.
const std::vector< PatchLocation > & getRangesAttributes() const
const DIE * getUnitDie() const
Climb up the parent chain to get the compile unit or type unit DIE that this DIE belongs to.
uint32_t ParentIdx
The index of this DIE's parent.
CompileUnit(DWARFUnit &OrigUnit, unsigned ID, bool CanUseODR, StringRef ClangModuleName)
Hold the input and output of the debug info size in bytes.
void noteRangeAttribute(const DIE &Die, PatchLocation Attr)
Keep track of a DW_AT_range attribute that we will need to patch up later.
unsigned getNumDIEs()
Returns the number of DIEs in the unit.
void setHasInterestingContent()
void addObjCAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
Add various accelerator entries for Die with Name which is stored in the string table at Offset.
void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
Add a name accelerator entry for Die with Name.
const std::vector< std::pair< PatchLocation, int64_t > > & getLocationAttributes() const
StringRef getSysRoot()
Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
unsigned getUniqueID() const
void addTypeAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool ObjcClassImplementation, uint32_t QualifiedNameHash)
Add a type accelerator entry for Die with Name which is stored in the string table at Offset.
typename Sizer::Allocator Allocator
A structured debug information entry.
bool Keep
Is the DIE part of the linked output?
DIE * Clone
Cloned version of that DIE.
uint64_t getStartOffset() const
bool isClangModule() const
bool Prune
Is this a pure forward declaration we can strip?
uint64_t computeNextUnitOffset(uint16_t DwarfVersion)
Compute the end offset for this unit.
Optional< PatchLocation > getUnitRangesAttribute() const
PatchLocation(DIE::value_iterator I)
uint32_t QualifiedNameHash
Hash of the fully qualified name.
DeclContext * Ctxt
ODR Declaration context.
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
void noteLocationAttribute(PatchLocation Attr, int64_t PcOffset)
Keep track of a location attribute pointing to a location list in the debug_loc section.
DIE * getOutputUnitDIE() const
DIEInfo & getInfo(unsigned Idx)
Align max(MaybeAlign Lhs, Align Rhs)
const std::string & getClangModuleName() const
const std::vector< AccelInfo > & getPubnames() const
void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset)
Add the low_pc of a label that is relocated by applying offset PCOffset.
void fixupForwardReferences()
Apply all fixups recorded by noteForwardReference().
void noteForwardReference(DIE *Die, const CompileUnit *RefUnit, DeclContext *Ctxt, PatchLocation Attr)
Keep track of a forward reference to DIE Die in RefUnit by Attr.
const std::vector< AccelInfo > & getNamespaces() const
const std::vector< AccelInfo > & getObjC() const
DwarfStringPoolEntryRef Name
Name of the entry.
String pool entry reference.
void setStartOffset(uint64_t DebugInfoSize)
const DIE * Die
DIE this entry describes.
const DIEInfo & getInfo(unsigned Idx) const
dwarf::Tag getTag() const
IntervalMap< KeyT, ValT, IntervalMapImpl::NodeSizer< KeyT, ValT >::LeafSize, IntervalMapHalfOpenInfo< KeyT > > HalfOpenIntervalMap
const std::vector< AccelInfo > & getPubtypes() const
bool hasInterestingContent()
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
AccelInfo(DwarfStringPoolEntryRef Name, const DIE *Die, uint32_t QualifiedNameHash, bool ObjCClassIsImplementation)
const FunctionIntervals & getFunctionRanges() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool ObjcClassImplementation
Is this an ObjC class implementation?
bool Incomplete
Does DIE transitively refer an incomplete decl?
uint64_t getHighPc() const
StringRef - Represent a constant reference to a string, i.e.
Information gathered about a DIE in the object file.
DIEInfo & getInfo(const DWARFDie &Die)
Optional< uint64_t > toUnsigned(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.
void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset)
Add a function range [LowPC, HighPC) that is relocated by applying offset PCOffset.
DWARFUnit & getOrigUnit() const