LLVM  10.0.0
Classes | Public Member Functions | List of all members
llvm::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/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)
 
DWARFUnit & getOrigUnit () const
 
unsigned getUniqueID () const
 
void createOutputDIE ()
 
DIE * getOutputUnitDIE () const
 
bool hasODR () const
 
bool isClangModule () const
 
uint16_t getLanguage ()
 
const std::string & getClangModuleName () const
 
DIEInfo & getInfo (unsigned Idx)
 
const DIEInfo & getInfo (unsigned Idx) const
 
uint64_t getStartOffset () const
 
uint64_t getNextUnitOffset () const
 
void setStartOffset (uint64_t DebugInfoSize)
 
uint64_t getLowPc () const
 
uint64_t getHighPc () const
 
bool hasLabelAt (uint64_t Addr) const
 
Optional< PatchLocation > getUnitRangesAttribute () const
 
const FunctionIntervals & getFunctionRanges () const
 
const std::vector< PatchLocation > & getRangesAttributes () const
 
const std::vector< std::pair< PatchLocation, int64_t > > & getLocationAttributes () const
 
void setHasInterestingContent ()
 
bool hasInterestingContent ()
 
void markEverythingAsKept ()
 Mark every DIE in this unit as kept. More...
 
uint64_t computeNextUnitOffset ()
 Compute the end offset for this unit. More...
 
void noteForwardReference (DIE *Die, const CompileUnit *RefUnit, DeclContext *Ctxt, PatchLocation Attr)
 Keep track of a forward reference to DIE Die in RefUnit by Attr. More...
 
void fixupForwardReferences ()
 Apply all fixups recorded by noteForwardReference(). More...
 
void addLabelLowPc (uint64_t LabelLowPc, int64_t PcOffset)
 Add the low_pc of a label that is relocated by applying offset PCOffset. More...
 
void addFunctionRange (uint64_t LowPC, uint64_t HighPC, int64_t PCOffset)
 Add a function range [LowPC, HighPC) that is relocated by applying offset PCOffset. More...
 
void noteRangeAttribute (const DIE &Die, PatchLocation Attr)
 Keep track of a DW_AT_range attribute that we will need to patch up later. More...
 
void noteLocationAttribute (PatchLocation Attr, int64_t PcOffset)
 Keep track of a location attribute pointing to a location list in the debug_loc section. More...
 
void addNamespaceAccelerator (const DIE *Die, DwarfStringPoolEntryRef Name)
 Add a name accelerator entry for Die with Name. More...
 
void addNameAccelerator (const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
 Add a name accelerator entry for Die with Name. More...
 
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. More...
 
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. More...
 
const std::vector< AccelInfo > & getPubnames () const
 
const std::vector< AccelInfo > & getPubtypes () const
 
const std::vector< AccelInfo > & getNamespaces () const
 
const std::vector< AccelInfo > & getObjC () const
 
StringRef getResolvedPath (unsigned FileNum)
 Get the full path for file FileNum in the line table. More...
 
void setResolvedPath (unsigned FileNum, StringRef Path)
 Set the fully resolved path for the line-table's file FileNum to Path. More...
 
MCSymbol * getLabelBegin ()
 
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 50 of file DWARFLinkerCompileUnit.h.

Constructor & Destructor Documentation

◆ CompileUnit()

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

Member Function Documentation

◆ addFunctionRange()

void llvm::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 98 of file DWARFLinkerCompileUnit.cpp.

References llvm::IntervalMap< KeyT, ValT, N, Traits >::insert(), and llvm::max().

◆ addLabelLowPc()

void llvm::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 94 of file DWARFLinkerCompileUnit.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::insert().

◆ 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 131 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 120 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 125 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 137 of file DWARFLinkerCompileUnit.cpp.

◆ computeNextUnitOffset()

uint64_t llvm::CompileUnit::computeNextUnitOffset ( )

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 64 of file DWARFLinkerCompileUnit.cpp.

◆ createOutputDIE()

void llvm::CompileUnit::createOutputDIE ( )
inline

Definition at line 104 of file DWARFLinkerCompileUnit.h.

◆ fixupForwardReferences()

void llvm::CompileUnit::fixupForwardReferences ( )

◆ getClangModuleName()

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

Definition at line 119 of file DWARFLinkerCompileUnit.h.

◆ getFunctionRanges()

const FunctionIntervals& llvm::CompileUnit::getFunctionRanges ( ) const
inline

Definition at line 136 of file DWARFLinkerCompileUnit.h.

◆ getHighPc()

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

Definition at line 129 of file DWARFLinkerCompileUnit.h.

◆ getInfo() [1/2]

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

Definition at line 121 of file DWARFLinkerCompileUnit.h.

References Info.

Referenced by llvm::inFunctionScope(), and llvm::DeclContext::setLastSeenDIE().

◆ getInfo() [2/2]

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

Definition at line 122 of file DWARFLinkerCompileUnit.h.

References Info.

◆ getLabelBegin()

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

Definition at line 251 of file DWARFLinkerCompileUnit.h.

◆ getLanguage()

uint16_t llvm::CompileUnit::getLanguage ( )

◆ getLocationAttributes()

const std::vector<std::pair<PatchLocation, int64_t> >& llvm::CompileUnit::getLocationAttributes ( ) const
inline

Definition at line 143 of file DWARFLinkerCompileUnit.h.

◆ getLowPc()

uint64_t llvm::CompileUnit::getLowPc ( ) const
inline

Definition at line 128 of file DWARFLinkerCompileUnit.h.

◆ getNamespaces()

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

Definition at line 233 of file DWARFLinkerCompileUnit.h.

◆ getNextUnitOffset()

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

Definition at line 125 of file DWARFLinkerCompileUnit.h.

◆ getObjC()

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

Definition at line 234 of file DWARFLinkerCompileUnit.h.

◆ getOrigUnit()

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

◆ getOutputUnitDIE()

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

Definition at line 109 of file DWARFLinkerCompileUnit.h.

References llvm::DIEUnit::getUnitDie().

◆ getPubnames()

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

Definition at line 231 of file DWARFLinkerCompileUnit.h.

◆ getPubtypes()

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

Definition at line 232 of file DWARFLinkerCompileUnit.h.

◆ getRangesAttributes()

const std::vector<PatchLocation>& llvm::CompileUnit::getRangesAttributes ( ) const
inline

Definition at line 138 of file DWARFLinkerCompileUnit.h.

◆ getResolvedPath()

StringRef llvm::CompileUnit::getResolvedPath ( unsigned  FileNum)
inline

Get the full path for file FileNum in the line table.

Definition at line 237 of file DWARFLinkerCompileUnit.h.

Referenced by llvm::DeclContextTree::getChildDeclContext().

◆ getStartOffset()

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

Definition at line 124 of file DWARFLinkerCompileUnit.h.

Referenced by fixupForwardReferences().

◆ getUniqueID()

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

◆ getUnitRangesAttribute()

Optional<PatchLocation> llvm::CompileUnit::getUnitRangesAttribute ( ) const
inline

Definition at line 132 of file DWARFLinkerCompileUnit.h.

◆ hasInterestingContent()

bool llvm::CompileUnit::hasInterestingContent ( )
inline

Definition at line 148 of file DWARFLinkerCompileUnit.h.

References Name.

◆ hasLabelAt()

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

Definition at line 130 of file DWARFLinkerCompileUnit.h.

◆ hasODR()

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

Definition at line 115 of file DWARFLinkerCompileUnit.h.

◆ isClangModule()

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

Definition at line 116 of file DWARFLinkerCompileUnit.h.

References llvm::dwarf::getLanguage().

◆ 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 32 of file DWARFLinkerCompileUnit.cpp.

References llvm::DWARFUnit::getAddressByteSize(), llvm::DWARFUnit::getDIEAtIndex(), llvm::DIE::getTag(), I, llvm::inFunctionScope(), and setHasInterestingContent().

◆ 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 75 of file DWARFLinkerCompileUnit.cpp.

◆ noteLocationAttribute()

void llvm::CompileUnit::noteLocationAttribute ( PatchLocation  Attr,
int64_t  PcOffset 
)

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

Definition at line 116 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 109 of file DWARFLinkerCompileUnit.cpp.

References llvm::DIE::getTag().

◆ setHasInterestingContent()

void llvm::CompileUnit::setHasInterestingContent ( )
inline

Definition at line 147 of file DWARFLinkerCompileUnit.h.

Referenced by markEverythingAsKept().

◆ setLabelBegin()

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

◆ setResolvedPath()

void llvm::CompileUnit::setResolvedPath ( unsigned  FileNum,
StringRef  Path 
)
inline

Set the fully resolved path for the line-table's file FileNum to Path.

Definition at line 245 of file DWARFLinkerCompileUnit.h.

Referenced by llvm::DeclContextTree::getChildDeclContext().

◆ setStartOffset()

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

Definition at line 126 of file DWARFLinkerCompileUnit.h.


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