class DeclContext
Declaration
class DeclContext { /* full declaration omitted */ };
Description
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 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.
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:78
Member Variables
- private unsigned int QualifiedNameHash = 0
- private uint32_t Line = 0
- private uint32_t ByteSize = 0
- private uint16_t Tag = dwarf::DW_TAG_compile_unit
- private unsigned int DefinedInClangModule
- private llvm::StringRef Name
- private llvm::StringRef File
- private const llvm::DeclContext& Parent
- private llvm::DWARFDie LastSeenDIE
- private uint32_t LastSeenCompileUnitID = 0
- private std::atomic<uint32_t> CanonicalDIEOffset = {0}
- private bool HasCanonicalDIE = false
Method Overview
- public DeclContext()
- public DeclContext(unsigned int Hash, uint32_t Line, uint32_t ByteSize, uint16_t Tag, llvm::StringRef Name, llvm::StringRef File, const llvm::DeclContext & Parent, llvm::DWARFDie LastSeenDIE = llvm::DWARFDie(), unsigned int CUId = 0)
- public uint32_t getCanonicalDIEOffset() const
- public uint32_t getQualifiedNameHash() const
- public uint16_t getTag() const
- public bool hasCanonicalDIE() const
- public bool isDefinedInClangModule() const
- public void setCanonicalDIEOffset(uint32_t Offset)
- public void setDefinedInClangModule(bool Val)
- public void setHasCanonicalDIE()
- public bool setLastSeenDIE(llvm::CompileUnit & U, const llvm::DWARFDie & Die)
Methods
¶DeclContext()
DeclContext()
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:82
¶DeclContext(
unsigned int Hash,
uint32_t Line,
uint32_t ByteSize,
uint16_t Tag,
llvm::StringRef Name,
llvm::StringRef File,
const llvm::DeclContext& Parent,
llvm::DWARFDie LastSeenDIE = llvm::DWARFDie(),
unsigned int CUId = 0)
DeclContext(
unsigned int Hash,
uint32_t Line,
uint32_t ByteSize,
uint16_t Tag,
llvm::StringRef Name,
llvm::StringRef File,
const llvm::DeclContext& Parent,
llvm::DWARFDie LastSeenDIE = llvm::DWARFDie(),
unsigned int CUId = 0)
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:84
Parameters
- unsigned int Hash
- uint32_t Line
- uint32_t ByteSize
- uint16_t Tag
- llvm::StringRef Name
- llvm::StringRef File
- const llvm::DeclContext& Parent
- llvm::DWARFDie LastSeenDIE = llvm::DWARFDie()
- unsigned int CUId = 0
¶uint32_t getCanonicalDIEOffset() const
uint32_t getCanonicalDIEOffset() const
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:99
¶uint32_t getQualifiedNameHash() const
uint32_t getQualifiedNameHash() const
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:91
¶uint16_t getTag() const
uint16_t getTag() const
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:105
¶bool hasCanonicalDIE() const
bool hasCanonicalDIE() const
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:97
¶bool isDefinedInClangModule() const
bool isDefinedInClangModule() const
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:102
¶void setCanonicalDIEOffset(uint32_t Offset)
void setCanonicalDIEOffset(uint32_t Offset)
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:100
Parameters
- uint32_t Offset
¶void setDefinedInClangModule(bool Val)
void setDefinedInClangModule(bool Val)
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:103
Parameters
- bool Val
¶void setHasCanonicalDIE()
void setHasCanonicalDIE()
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:95
¶bool setLastSeenDIE(llvm::CompileUnit& U,
const llvm::DWARFDie& Die)
bool setLastSeenDIE(llvm::CompileUnit& U,
const llvm::DWARFDie& Die)
Declared at: llvm/include/llvm/DWARFLinker/DWARFLinkerDeclContext.h:93
Parameters
- llvm::CompileUnit& U
- const llvm::DWARFDie& Die