LLVM 20.0.0git
|
The helper class to build type name based on DIE properties. More...
#include "DWARFLinker/Parallel/SyntheticTypeNameBuilder.h"
Public Member Functions | |
SyntheticTypeNameBuilder (TypePool &TypePoolRef) | |
Error | assignName (UnitEntryPairTy InputUnitEntryPair, std::optional< std::pair< size_t, size_t > > ChildIndex) |
Create synthetic name for the specified DIE InputUnitEntryPair and assign created name to the DIE type info. | |
Protected Member Functions | |
void | addArrayDimension (UnitEntryPairTy InputUnitEntryPair) |
Add array type dimension. | |
Error | addSignature (UnitEntryPairTy InputUnitEntryPair, bool addTemplateParameters) |
Add signature( entry type plus type of parameters plus type of template parameters(if addTemplateParameters is true). | |
Error | addParamNames (CompileUnit &CU, SmallVector< const DWARFDebugInfoEntry *, 20 > &FunctionParameters) |
Add specified FunctionParameters to the built name. | |
Error | addTemplateParamNames (CompileUnit &CU, SmallVector< const DWARFDebugInfoEntry *, 10 > &TemplateParameters) |
Add specified TemplateParameters to the built name. | |
void | addOrderedName (CompileUnit &CU, const DWARFDebugInfoEntry *DieEntry) |
Add ordered name to the built name. | |
Error | addReferencedODRDies (UnitEntryPairTy InputUnitEntryPair, bool AssignNameToTypeDescriptor, ArrayRef< dwarf::Attribute > ODRAttrs) |
Analyze InputUnitEntryPair's ODR attributes and put names of the referenced type dies to the built name. | |
Error | addParentName (UnitEntryPairTy &InputUnitEntryPair) |
Add names of parent dies to the built name. | |
void | addDieNameFromDeclFileAndDeclLine (UnitEntryPairTy &InputUnitEntryPair, bool &HasDeclFileName) |
void | addTypePrefix (const DWARFDebugInfoEntry *DieEntry) |
Add type prefix to the built name. | |
Error | addTypeName (UnitEntryPairTy InputUnitEntryPair, bool AddParentNames) |
Add type name to the built name. | |
Error | addDIETypeName (UnitEntryPairTy InputUnitEntryPair, std::optional< std::pair< size_t, size_t > > ChildIndex, bool AssignNameToTypeDescriptor) |
Analyze InputUnitEntryPair for the type name and possibly assign built type name to the DIE's type info. | |
void | addOrderedName (std::pair< size_t, size_t > ChildIdx) |
Add ordered name to the built name. | |
void | addValueName (UnitEntryPairTy InputUnitEntryPair, dwarf::Attribute Attr) |
Add value name to the built name. | |
Protected Attributes | |
SmallString< 1000 > | SyntheticName |
Buffer keeping bult name. | |
size_t | RecursionDepth = 0 |
Recursion counter. | |
TypePool & | TypePoolRef |
Type pool. | |
The helper class to build type name based on DIE properties.
It builds synthetic name based on explicit attributes: DW_AT_name, DW_AT_linkage_name or based on implicit attributes(DW_AT_decl*). Names for specific DIEs(like subprograms, template classes...) include additional attributes: subprogram parameters, template parameters, array ranges. Examples of built name:
class A { } : {8}A
namspace llvm { class A { } } : {1}llvm{8}A
template <int> structure B { } : {F}B<{0}int>
void foo ( int p1, float p3 ) : {a}void foo({0}int, {0}int)
int *ptr; : {c}ptr {0}int
int var; : {d}var
These names is used to refer DIEs describing types.
Definition at line 46 of file SyntheticTypeNameBuilder.h.
|
inline |
Definition at line 48 of file SyntheticTypeNameBuilder.h.
|
protected |
Add array type dimension.
Definition at line 36 of file SyntheticTypeNameBuilder.cpp.
References llvm::dwarf_linker::parallel::UnitEntryPairTy::CU, llvm::dwarf_linker::parallel::UnitEntryPairTy::DieEntry, llvm::dwarf_linker::parallel::CompileUnit::find(), llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), llvm::dwarf_linker::parallel::CompileUnit::getFirstChildEntry(), llvm::dwarf_linker::parallel::CompileUnit::getSiblingEntry(), and SyntheticName.
Referenced by addTypeName().
|
protected |
DieEntry
. The name is constructed from the dwarf::DW_AT_decl_file and dwarf::DW_AT_decl_line attributes. Definition at line 239 of file SyntheticTypeNameBuilder.cpp.
References llvm::dwarf_linker::parallel::UnitEntryPairTy::CU, llvm::dwarf_linker::parallel::UnitEntryPairTy::DieEntry, llvm::dwarf_linker::parallel::CompileUnit::find(), llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable(), SyntheticName, and llvm::dwarf::toUnsigned().
Referenced by addTypeName().
|
protected |
Analyze InputUnitEntryPair
for the type name and possibly assign built type name to the DIE's type info.
NOTE: while analyzing types we may create different kind of names for the same type depending on whether the type is part of another type. f.e. DW_TAG_formal_parameter would receive "{02}01" name when examined alone. Or "{0}int" name when it is a part of a function name: {a}void foo({0}int). The AssignNameToTypeDescriptor
tells whether the type name is part of another type name and then should not be assigned to DIE type descriptor.
Definition at line 393 of file SyntheticTypeNameBuilder.cpp.
References addOrderedName(), addParentName(), addTypeName(), addTypePrefix(), llvm::dwarf_linker::parallel::UnitEntryPairTy::CU, llvm::dwarf_linker::parallel::UnitEntryPairTy::DieEntry, llvm::dwarf_linker::parallel::CompileUnit::getDieTypeEntry(), llvm::StringMapEntry< ValueTy >::getKey(), getTypeDeduplicationCandidate(), llvm::dwarf_linker::parallel::TypePool::insert(), llvm::dwarf_linker::parallel::CompileUnit::setDieTypeEntry(), llvm::SmallVectorBase< Size_T >::size(), llvm::SmallString< InternalLen >::substr(), llvm::Error::success(), SyntheticName, and TypePoolRef.
Referenced by addParentName(), addReferencedODRDies(), and assignName().
|
protected |
Add ordered name to the built name.
Referenced by addDIETypeName().
|
protected |
Add ordered name to the built name.
Definition at line 158 of file SyntheticTypeNameBuilder.cpp.
References llvm::format_hex_no_prefix(), Name, and SyntheticName.
|
protected |
Add specified FunctionParameters
to the built name.
Definition at line 112 of file SyntheticTypeNameBuilder.cpp.
References addReferencedODRDies(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::Error::success(), SyntheticName, llvm::dwarf::toUnsigned(), and TypeAttr.
Referenced by addSignature().
|
protected |
Add names of parent dies to the built name.
Definition at line 194 of file SyntheticTypeNameBuilder.cpp.
References addDIETypeName(), llvm::dwarf_linker::parallel::UnitEntryPairTy::getParent(), getTypeDeduplicationCandidate(), llvm::SmallVectorImpl< T >::resize(), llvm::reverse(), llvm::SmallVectorBase< Size_T >::size(), llvm::Error::success(), and SyntheticName.
Referenced by addDIETypeName().
|
protected |
Analyze InputUnitEntryPair's
ODR attributes and put names of the referenced type dies to the built name.
Definition at line 277 of file SyntheticTypeNameBuilder.cpp.
References addDIETypeName(), llvm::createStringError(), llvm::dwarf_linker::parallel::UnitEntryPairTy::CU, llvm::dwarf_linker::parallel::UnitEntryPairTy::DieEntry, llvm::dwarf_linker::parallel::CompileUnit::find(), RecursionDepth, llvm::dwarf_linker::parallel::Resolve, llvm::dwarf_linker::parallel::CompileUnit::resolveDIEReference(), llvm::Error::success(), and SyntheticName.
Referenced by addParamNames(), addSignature(), addTemplateParamNames(), and addTypeName().
|
protected |
Add signature( entry type plus type of parameters plus type of template parameters(if addTemplateParameters
is true).
Definition at line 62 of file SyntheticTypeNameBuilder.cpp.
References addParamNames(), addReferencedODRDies(), addTemplateParamNames(), llvm::dwarf_linker::parallel::UnitEntryPairTy::CU, llvm::dwarf_linker::parallel::UnitEntryPairTy::DieEntry, llvm::DWARFDebugInfoEntry::getAbbreviationDeclarationPtr(), llvm::dwarf_linker::parallel::CompileUnit::getFirstChildEntry(), llvm::dwarf_linker::parallel::CompileUnit::getSiblingEntry(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Error::success(), SyntheticName, and TypeAttr.
Referenced by addTypeName().
|
protected |
Add specified TemplateParameters
to the built name.
Definition at line 130 of file SyntheticTypeNameBuilder.cpp.
References addReferencedODRDies(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorBase< Size_T >::empty(), llvm::Error::success(), SyntheticName, and TypeAttr.
Referenced by addSignature().
|
protected |
Add type name to the built name.
Definition at line 315 of file SyntheticTypeNameBuilder.cpp.
References addArrayDimension(), addDieNameFromDeclFileAndDeclLine(), addReferencedODRDies(), addSignature(), addValueName(), llvm::dwarf_linker::parallel::UnitEntryPairTy::CU, llvm::dwarf_linker::parallel::UnitEntryPairTy::DieEntry, llvm::dwarf_linker::parallel::CompileUnit::find(), llvm::dwarf_linker::parallel::getODRAttributes(), llvm::DWARFDebugInfoEntry::getTag(), Name, llvm::Error::success(), SyntheticName, and llvm::dwarf::toStringRef().
Referenced by addDIETypeName().
|
protected |
Add type prefix to the built name.
Definition at line 432 of file SyntheticTypeNameBuilder.cpp.
References llvm::DWARFDebugInfoEntry::getTag(), llvm_unreachable, and SyntheticName.
Referenced by addDIETypeName().
|
protected |
Add value name to the built name.
Definition at line 263 of file SyntheticTypeNameBuilder.cpp.
References llvm::dwarf_linker::parallel::UnitEntryPairTy::CU, llvm::dwarf_linker::parallel::UnitEntryPairTy::DieEntry, llvm::dwarf_linker::parallel::CompileUnit::find(), and SyntheticName.
Referenced by addTypeName().
Error SyntheticTypeNameBuilder::assignName | ( | UnitEntryPairTy | InputUnitEntryPair, |
std::optional< std::pair< size_t, size_t > > | ChildIndex | ||
) |
Create synthetic name for the specified DIE InputUnitEntryPair
and assign created name to the DIE type info.
ChildIndex
is used to create name for ordered DIEs(function arguments f.e.).
Definition at line 19 of file SyntheticTypeNameBuilder.cpp.
References addDIETypeName(), assert(), llvm::dwarf_linker::parallel::UnitEntryPairTy::CU, llvm::dwarf_linker::parallel::UnitEntryPairTy::DieEntry, llvm::dwarf_linker::parallel::CompileUnit::getDIEInfo(), llvm::dwarf_linker::parallel::CompileUnit::getDieTypeEntry(), Info, RecursionDepth, llvm::SmallVectorImpl< T >::resize(), llvm::Error::success(), and SyntheticName.
|
protected |
Recursion counter.
Definition at line 122 of file SyntheticTypeNameBuilder.h.
Referenced by addReferencedODRDies(), and assignName().
|
protected |
Buffer keeping bult name.
Definition at line 119 of file SyntheticTypeNameBuilder.h.
Referenced by addArrayDimension(), addDieNameFromDeclFileAndDeclLine(), addDIETypeName(), addOrderedName(), addParamNames(), addParentName(), addReferencedODRDies(), addSignature(), addTemplateParamNames(), addTypeName(), addTypePrefix(), addValueName(), and assignName().
|
protected |
Type pool.
Definition at line 125 of file SyntheticTypeNameBuilder.h.
Referenced by addDIETypeName().