LLVM 22.0.0git
llvm::dwarf_linker::classic::CompileUnit Class Reference

Stores all information relating to a compile unit, be it in its original instance in the object file to its brand new cloned and generated DIE tree. More...

#include "llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h"

Classes

struct  AccelInfo
struct  DIEInfo
 Information gathered about a DIE in the object file. More...

Public Member Functions

 CompileUnit (DWARFUnit &OrigUnit, unsigned ID, bool CanUseODR, StringRef ClangModuleName)
DWARFUnitgetOrigUnit () const
unsigned getUniqueID () const
void createOutputDIE ()
DIEgetOutputUnitDIE () const
dwarf::Tag getTag () const
bool hasODR () const
bool isClangModule () const
LLVM_ABI uint16_t getLanguage ()
LLVM_ABI StringRef getSysRoot ()
 Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.
const std::string & getClangModuleName () const
DIEInfogetInfo (unsigned Idx)
const DIEInfogetInfo (unsigned Idx) const
DIEInfogetInfo (const DWARFDie &Die)
uint64_t getStartOffset () const
uint64_t getNextUnitOffset () const
void setStartOffset (uint64_t DebugInfoSize)
std::optional< uint64_tgetLowPc () const
uint64_t getHighPc () const
bool hasLabelAt (uint64_t Addr) const
const RangesTygetFunctionRanges () const
const RngListAttributesTygetRangesAttributes ()
std::optional< PatchLocationgetUnitRangesAttribute () const
const LocListAttributesTygetLocationAttributes () const
const StmtSeqListAttributesTygetStmtSeqListAttributes () const
LLVM_ABI void markEverythingAsKept ()
 Mark every DIE in this unit as kept.
LLVM_ABI uint64_t computeNextUnitOffset (uint16_t DwarfVersion)
 Compute the end offset for this unit.
LLVM_ABI void noteForwardReference (DIE *Die, const CompileUnit *RefUnit, DeclContext *Ctxt, PatchLocation Attr)
 Keep track of a forward reference to DIE Die in RefUnit by Attr.
LLVM_ABI void fixupForwardReferences ()
 Apply all fixups recorded by noteForwardReference().
LLVM_ABI void addLabelLowPc (uint64_t LabelLowPc, int64_t PcOffset)
 Add the low_pc of a label that is relocated by applying offset PCOffset.
LLVM_ABI void addFunctionRange (uint64_t LowPC, uint64_t HighPC, int64_t PCOffset)
 Add a function range [LowPC, HighPC) that is relocated by applying offset PCOffset.
LLVM_ABI void noteRangeAttribute (const DIE &Die, PatchLocation Attr)
 Keep track of a DW_AT_range attribute that we will need to patch up later.
LLVM_ABI void noteLocationAttribute (PatchLocation Attr)
 Keep track of a location attribute pointing to a location list in the debug_loc section.
LLVM_ABI void noteStmtSeqListAttribute (PatchLocation Attr)
LLVM_ABI void addNamespaceAccelerator (const DIE *Die, DwarfStringPoolEntryRef Name)
 Add a name accelerator entry for Die with Name.
LLVM_ABI void addNameAccelerator (const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
 Add a name accelerator entry for Die with Name.
LLVM_ABI 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.
LLVM_ABI 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.
const std::vector< AccelInfo > & getPubnames () const
const std::vector< AccelInfo > & getPubtypes () const
const std::vector< AccelInfo > & getNamespaces () const
const std::vector< AccelInfo > & getObjC () const
MCSymbolgetLabelBegin ()
void setLabelBegin (MCSymbol *S)

Detailed Description

Stores all information relating to a compile unit, be it in its original instance in the object file to its brand new cloned and generated DIE tree.

Definition at line 65 of file DWARFLinkerCompileUnit.h.

Constructor & Destructor Documentation

◆ CompileUnit()

llvm::dwarf_linker::classic::CompileUnit::CompileUnit ( DWARFUnit & OrigUnit,
unsigned ID,
bool CanUseODR,
StringRef ClangModuleName )
inline

Definition at line 110 of file DWARFLinkerCompileUnit.h.

References if(), and llvm::dwarf::toUnsigned().

Referenced by fixupForwardReferences(), and noteForwardReference().

Member Function Documentation

◆ addFunctionRange()

void CompileUnit::addFunctionRange ( uint64_t LowPC,
uint64_t HighPC,
int64_t PCOffset )

Add a function range [LowPC, HighPC) that is relocated by applying offset PCOffset.

Definition at line 165 of file DWARFLinkerCompileUnit.cpp.

◆ addLabelLowPc()

void CompileUnit::addLabelLowPc ( uint64_t LabelLowPc,
int64_t PcOffset )

Add the low_pc of a label that is relocated by applying offset PCOffset.

Definition at line 161 of file DWARFLinkerCompileUnit.cpp.

◆ addNameAccelerator()

void llvm::CompileUnit::addNameAccelerator ( const DIE * Die,
DwarfStringPoolEntryRef Name,
bool SkipPubnamesSection = false )

Add a name accelerator entry for Die with Name.

Definition at line 203 of file DWARFLinkerCompileUnit.cpp.

◆ addNamespaceAccelerator()

void llvm::CompileUnit::addNamespaceAccelerator ( const DIE * Die,
DwarfStringPoolEntryRef Name )

Add a name accelerator entry for Die with Name.

Definition at line 192 of file DWARFLinkerCompileUnit.cpp.

◆ addObjCAccelerator()

void llvm::CompileUnit::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.

Name must be an Objective-C selector.

Definition at line 197 of file DWARFLinkerCompileUnit.cpp.

◆ addTypeAccelerator()

void llvm::CompileUnit::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.

Definition at line 209 of file DWARFLinkerCompileUnit.cpp.

◆ computeNextUnitOffset()

uint64_t llvm::CompileUnit::computeNextUnitOffset ( uint16_t DwarfVersion)

Compute the end offset for this unit.

Must be called after the CU's DIEs have been cloned.

Returns
the next unit offset (which is also the current debug_info section size).

Definition at line 127 of file DWARFLinkerCompileUnit.cpp.

◆ createOutputDIE()

void llvm::dwarf_linker::classic::CompileUnit::createOutputDIE ( )
inline

Definition at line 134 of file DWARFLinkerCompileUnit.h.

◆ fixupForwardReferences()

◆ getClangModuleName()

const std::string & llvm::dwarf_linker::classic::CompileUnit::getClangModuleName ( ) const
inline

Definition at line 150 of file DWARFLinkerCompileUnit.h.

◆ getFunctionRanges()

const RangesTy & llvm::dwarf_linker::classic::CompileUnit::getFunctionRanges ( ) const
inline

Definition at line 168 of file DWARFLinkerCompileUnit.h.

◆ getHighPc()

uint64_t llvm::dwarf_linker::classic::CompileUnit::getHighPc ( ) const
inline

Definition at line 165 of file DWARFLinkerCompileUnit.h.

◆ getInfo() [1/3]

DIEInfo & llvm::dwarf_linker::classic::CompileUnit::getInfo ( const DWARFDie & Die)
inline

Definition at line 155 of file DWARFLinkerCompileUnit.h.

References llvm::DWARFUnit::getDIEIndex(), and getOrigUnit().

◆ getInfo() [2/3]

DIEInfo & llvm::dwarf_linker::classic::CompileUnit::getInfo ( unsigned Idx)
inline

Definition at line 152 of file DWARFLinkerCompileUnit.h.

◆ getInfo() [3/3]

const DIEInfo & llvm::dwarf_linker::classic::CompileUnit::getInfo ( unsigned Idx) const
inline

Definition at line 153 of file DWARFLinkerCompileUnit.h.

◆ getLabelBegin()

MCSymbol * llvm::dwarf_linker::classic::CompileUnit::getLabelBegin ( )
inline

Definition at line 278 of file DWARFLinkerCompileUnit.h.

◆ getLanguage()

uint16_t llvm::CompileUnit::getLanguage ( )

◆ getLocationAttributes()

const LocListAttributesTy & llvm::dwarf_linker::classic::CompileUnit::getLocationAttributes ( ) const
inline

Definition at line 176 of file DWARFLinkerCompileUnit.h.

◆ getLowPc()

std::optional< uint64_t > llvm::dwarf_linker::classic::CompileUnit::getLowPc ( ) const
inline

Definition at line 164 of file DWARFLinkerCompileUnit.h.

◆ getNamespaces()

const std::vector< AccelInfo > & llvm::dwarf_linker::classic::CompileUnit::getNamespaces ( ) const
inline

Definition at line 275 of file DWARFLinkerCompileUnit.h.

◆ getNextUnitOffset()

uint64_t llvm::dwarf_linker::classic::CompileUnit::getNextUnitOffset ( ) const
inline

Definition at line 161 of file DWARFLinkerCompileUnit.h.

◆ getObjC()

const std::vector< AccelInfo > & llvm::dwarf_linker::classic::CompileUnit::getObjC ( ) const
inline

Definition at line 276 of file DWARFLinkerCompileUnit.h.

◆ getOrigUnit()

DWARFUnit & llvm::dwarf_linker::classic::CompileUnit::getOrigUnit ( ) const
inline

Definition at line 130 of file DWARFLinkerCompileUnit.h.

Referenced by getInfo(), getLanguage(), and getSysRoot().

◆ getOutputUnitDIE()

DIE * llvm::dwarf_linker::classic::CompileUnit::getOutputUnitDIE ( ) const
inline

Definition at line 136 of file DWARFLinkerCompileUnit.h.

References llvm::DIEUnit::getUnitDie().

◆ getPubnames()

const std::vector< AccelInfo > & llvm::dwarf_linker::classic::CompileUnit::getPubnames ( ) const
inline

Definition at line 273 of file DWARFLinkerCompileUnit.h.

◆ getPubtypes()

const std::vector< AccelInfo > & llvm::dwarf_linker::classic::CompileUnit::getPubtypes ( ) const
inline

Definition at line 274 of file DWARFLinkerCompileUnit.h.

◆ getRangesAttributes()

const RngListAttributesTy & llvm::dwarf_linker::classic::CompileUnit::getRangesAttributes ( )
inline

Definition at line 170 of file DWARFLinkerCompileUnit.h.

◆ getStartOffset()

uint64_t llvm::dwarf_linker::classic::CompileUnit::getStartOffset ( ) const
inline

Definition at line 160 of file DWARFLinkerCompileUnit.h.

Referenced by fixupForwardReferences().

◆ getStmtSeqListAttributes()

const StmtSeqListAttributesTy & llvm::dwarf_linker::classic::CompileUnit::getStmtSeqListAttributes ( ) const
inline

Definition at line 182 of file DWARFLinkerCompileUnit.h.

◆ getSysRoot()

StringRef llvm::CompileUnit::getSysRoot ( )

Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.

Definition at line 57 of file DWARFLinkerCompileUnit.cpp.

References getOrigUnit(), llvm::DWARFUnit::getUnitDIE(), llvm::StringRef::str(), and llvm::dwarf::toStringRef().

◆ getTag()

dwarf::Tag llvm::dwarf_linker::classic::CompileUnit::getTag ( ) const
inline

Definition at line 142 of file DWARFLinkerCompileUnit.h.

◆ getUniqueID()

unsigned llvm::dwarf_linker::classic::CompileUnit::getUniqueID ( ) const
inline

Definition at line 132 of file DWARFLinkerCompileUnit.h.

◆ getUnitRangesAttribute()

std::optional< PatchLocation > llvm::dwarf_linker::classic::CompileUnit::getUnitRangesAttribute ( ) const
inline

Definition at line 172 of file DWARFLinkerCompileUnit.h.

◆ hasLabelAt()

bool llvm::dwarf_linker::classic::CompileUnit::hasLabelAt ( uint64_t Addr) const
inline

Definition at line 166 of file DWARFLinkerCompileUnit.h.

◆ hasODR()

bool llvm::dwarf_linker::classic::CompileUnit::hasODR ( ) const
inline

Definition at line 144 of file DWARFLinkerCompileUnit.h.

◆ isClangModule()

bool llvm::dwarf_linker::classic::CompileUnit::isClangModule ( ) const
inline

Definition at line 145 of file DWARFLinkerCompileUnit.h.

◆ markEverythingAsKept()

void llvm::CompileUnit::markEverythingAsKept ( )

Mark every DIE in this unit as kept.

This function also marks variables as InDebugMap so that they appear in the reconstructed accelerator tables.

Definition at line 65 of file DWARFLinkerCompileUnit.cpp.

References llvm::Data, llvm::DIE::getTag(), I, llvm::inFunctionScope(), and llvm::toStringRef().

◆ noteForwardReference()

void llvm::CompileUnit::noteForwardReference ( DIE * Die,
const CompileUnit * RefUnit,
DeclContext * Ctxt,
PatchLocation Attr )

Keep track of a forward reference to DIE Die in RefUnit by Attr.

Keep track of a forward cross-cu reference from this unit to Die that lives in RefUnit.

The attribute should be fixed up later to point to the absolute offset of Die in the debug_info section or to the canonical offset of Ctxt if it is non-null.

Definition at line 138 of file DWARFLinkerCompileUnit.cpp.

References CompileUnit().

◆ noteLocationAttribute()

void llvm::CompileUnit::noteLocationAttribute ( PatchLocation Attr)

Keep track of a location attribute pointing to a location list in the debug_loc section.

Definition at line 184 of file DWARFLinkerCompileUnit.cpp.

◆ noteRangeAttribute()

void llvm::CompileUnit::noteRangeAttribute ( const DIE & Die,
PatchLocation Attr )

Keep track of a DW_AT_range attribute that we will need to patch up later.

Definition at line 175 of file DWARFLinkerCompileUnit.cpp.

References llvm::DIE::getTag().

◆ noteStmtSeqListAttribute()

void llvm::CompileUnit::noteStmtSeqListAttribute ( PatchLocation Attr)

Definition at line 188 of file DWARFLinkerCompileUnit.cpp.

◆ setLabelBegin()

void llvm::dwarf_linker::classic::CompileUnit::setLabelBegin ( MCSymbol * S)
inline

Definition at line 279 of file DWARFLinkerCompileUnit.h.

◆ setStartOffset()

void llvm::dwarf_linker::classic::CompileUnit::setStartOffset ( uint64_t DebugInfoSize)
inline

Definition at line 162 of file DWARFLinkerCompileUnit.h.


The documentation for this class was generated from the following files: