LLVM: llvm::dwarf_linker::classic::DeclContext Class Reference (original) (raw)

A DeclContext is a named program scope that is used for ODR uniquing of types. More...

#include "[llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h](DWARFLinkerDeclContext%5F8h%5Fsource.html)"

Public Member Functions
DeclContext ()
DeclContext (unsigned Hash, uint32_t Line, uint32_t ByteSize, uint16_t Tag, StringRef Name, StringRef NameForUniquing, StringRef File, const DeclContext &Parent, DWARFDie LastSeenDIE=DWARFDie(), unsigned CUId=0)
uint32_t getQualifiedNameHash () const
bool setLastSeenDIE (CompileUnit &U, const DWARFDie &Die)
Set the last DIE/CU a context was seen in and, possibly invalidate the context if it is ambiguous.
void setHasCanonicalDIE ()
bool hasCanonicalDIE () const
uint32_t getCanonicalDIEOffset () const
void setCanonicalDIEOffset (uint32_t Offset)
llvm::StringRef getCanonicalName () const
bool isDefinedInClangModule () const
void setDefinedInClangModule (bool Val)
uint16_t getTag () const

A DeclContext is a named program scope that is used for ODR uniquing of types.

The set of DeclContext for the ODR-subject parts of a Dwarf link is expanded (and uniqued) with each new object file processed. We need to determine the context of each DIE in an linked object file to see if the corresponding type has already been emitted.

The contexts are conceptually organized as a tree (eg. a function scope is contained in a namespace scope that contains other scopes), but storing/accessing them in an actual tree is too inefficient: we need to be able to very quickly query a context for a given child context by name. Storing a [StringMap](classllvm%5F1%5F1StringMap.html "StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...") in each DeclContext would be too space inefficient.

The solution here is to give each DeclContext a link to its parent (this allows to walk up the tree), but to query the existence of a specific DeclContext using a separate DenseMap keyed on the hash of the fully qualified name of the context.

Definition at line 80 of file DWARFLinkerDeclContext.h.

Map

llvm::dwarf_linker::classic::DeclContext::DeclContext ( ) inline

DeclContext() [2/2]

getCanonicalDIEOffset()

uint32_t llvm::dwarf_linker::classic::DeclContext::getCanonicalDIEOffset ( ) const inline

getCanonicalName()

llvm::StringRef llvm::dwarf_linker::classic::DeclContext::getCanonicalName ( ) const inline

getQualifiedNameHash()

uint32_t llvm::dwarf_linker::classic::DeclContext::getQualifiedNameHash ( ) const inline

getTag()

uint16_t llvm::dwarf_linker::classic::DeclContext::getTag ( ) const inline

hasCanonicalDIE()

bool llvm::dwarf_linker::classic::DeclContext::hasCanonicalDIE ( ) const inline

isDefinedInClangModule()

bool llvm::dwarf_linker::classic::DeclContext::isDefinedInClangModule ( ) const inline

setCanonicalDIEOffset()

void llvm::dwarf_linker::classic::DeclContext::setCanonicalDIEOffset ( uint32_t Offset) inline

setDefinedInClangModule()

void llvm::dwarf_linker::classic::DeclContext::setDefinedInClangModule ( bool Val) inline

setHasCanonicalDIE()

void llvm::dwarf_linker::classic::DeclContext::setHasCanonicalDIE ( ) inline

setLastSeenDIE()

Set the last DIE/CU a context was seen in and, possibly invalidate the context if it is ambiguous.

In the current implementation, we don't handle overloaded functions well, because the argument types are not taken into account when computing the DeclContext tree.

Some of this is mitigated byt using mangled names that do contain the arguments types, but sometimes (e.g. with function templates) we don't have that. In that case, just do not unique anything that refers to the contexts we are not able to distinguish.

If a context that is not a namespace appears twice in the same CU, we know it is ambiguous. Make it invalid.

Definition at line 34 of file DWARFLinkerDeclContext.cpp.

References llvm::DWARFUnit::getDIEIndex().


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