clang
13.0.0git
|
This class gathers all debug information during compilation and is responsible for emitting to llvm globals or pass directly to the backend. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/CGDebugInfo.h"
Public Member Functions | |
CGDebugInfo (CodeGenModule &CGM) | |
~CGDebugInfo () | |
void | finalize () |
std::string | remapDIPath (StringRef) const |
Remap a given path with the current debug prefix map. More... | |
void | registerVLASizeExpression (QualType Ty, llvm::Metadata *SizeExpr) |
Register VLA size expression debug node with the qualified type. More... | |
void | setLocation (SourceLocation Loc) |
Update the current source location. More... | |
SourceLocation | getLocation () const |
Return the current source location. More... | |
void | setInlinedAt (llvm::MDNode *InlinedAt) |
Update the current inline scope. More... | |
llvm::MDNode * | getInlinedAt () const |
llvm::DebugLoc | SourceLocToDebugLoc (SourceLocation Loc) |
void | EmitLocation (CGBuilderTy &Builder, SourceLocation Loc) |
Emit metadata to indicate a change in line/column information in the source file. More... | |
void | emitFunctionStart (GlobalDecl GD, SourceLocation Loc, SourceLocation ScopeLoc, QualType FnType, llvm::Function *Fn, bool CurFnIsThunk) |
Emit a call to llvm.dbg.function.start to indicate start of a new function. More... | |
void | EmitInlineFunctionStart (CGBuilderTy &Builder, GlobalDecl GD) |
Start a new scope for an inlined function. More... | |
void | EmitInlineFunctionEnd (CGBuilderTy &Builder) |
End an inlined function scope. More... | |
void | EmitFunctionDecl (GlobalDecl GD, SourceLocation Loc, QualType FnType, llvm::Function *Fn=nullptr) |
Emit debug info for a function declaration. More... | |
void | EmitFuncDeclForCallSite (llvm::CallBase *CallOrInvoke, QualType CalleeType, const FunctionDecl *CalleeDecl) |
Emit debug info for an extern function being called. More... | |
void | EmitFunctionEnd (CGBuilderTy &Builder, llvm::Function *Fn) |
Constructs the debug code for exiting a function. More... | |
void | EmitLexicalBlockStart (CGBuilderTy &Builder, SourceLocation Loc) |
Emit metadata to indicate the beginning of a new lexical block and push the block onto the stack. More... | |
void | EmitLexicalBlockEnd (CGBuilderTy &Builder, SourceLocation Loc) |
Emit metadata to indicate the end of a new lexical block and pop the current block. More... | |
llvm::DILocalVariable * | EmitDeclareOfAutoVariable (const VarDecl *Decl, llvm::Value *AI, CGBuilderTy &Builder, const bool UsePointerValue=false) |
Emit call to llvm.dbg.declare for an automatic variable declaration. More... | |
void | EmitLabel (const LabelDecl *D, CGBuilderTy &Builder) |
Emit call to llvm.dbg.label for an label. More... | |
void | EmitDeclareOfBlockDeclRefVariable (const VarDecl *variable, llvm::Value *storage, CGBuilderTy &Builder, const CGBlockInfo &blockInfo, llvm::Instruction *InsertPoint=nullptr) |
Emit call to llvm.dbg.declare for an imported variable declaration in a block. More... | |
llvm::DILocalVariable * | EmitDeclareOfArgVariable (const VarDecl *Decl, llvm::Value *AI, unsigned ArgNo, CGBuilderTy &Builder) |
Emit call to llvm.dbg.declare for an argument variable declaration. More... | |
void | EmitDeclareOfBlockLiteralArgVariable (const CGBlockInfo &block, StringRef Name, unsigned ArgNo, llvm::AllocaInst *LocalAddr, CGBuilderTy &Builder) |
Emit call to llvm.dbg.declare for the block-literal argument to a block invocation function. More... | |
void | EmitGlobalVariable (llvm::GlobalVariable *GV, const VarDecl *Decl) |
Emit information about a global variable. More... | |
void | EmitGlobalVariable (const ValueDecl *VD, const APValue &Init) |
Emit a constant global variable's debug info. More... | |
void | EmitExternalVariable (llvm::GlobalVariable *GV, const VarDecl *Decl) |
Emit information about an external variable. More... | |
void | EmitUsingDirective (const UsingDirectiveDecl &UD) |
Emit C++ using directive. More... | |
void | EmitExplicitCastType (QualType Ty) |
Emit the type explicitly casted to. More... | |
void | EmitAndRetainType (QualType Ty) |
Emit the type even if it might not be used. More... | |
void | EmitUsingDecl (const UsingDecl &UD) |
Emit C++ using declaration. More... | |
void | EmitImportDecl (const ImportDecl &ID) |
Emit an @import declaration. More... | |
llvm::DIImportedEntity * | EmitNamespaceAlias (const NamespaceAliasDecl &NA) |
Emit C++ namespace alias. More... | |
llvm::DIType * | getOrCreateRecordType (QualType Ty, SourceLocation L) |
Emit record type's standalone debug info. More... | |
llvm::DIType * | getOrCreateInterfaceType (QualType Ty, SourceLocation Loc) |
Emit an Objective-C interface type standalone debug info. More... | |
llvm::DIType * | getOrCreateStandaloneType (QualType Ty, SourceLocation Loc) |
Emit standalone debug info for a type. More... | |
void | addHeapAllocSiteMetadata (llvm::CallBase *CallSite, QualType AllocatedTy, SourceLocation Loc) |
Add heapallocsite metadata for MSAllocator calls. More... | |
void | completeType (const EnumDecl *ED) |
void | completeType (const RecordDecl *RD) |
void | completeRequiredType (const RecordDecl *RD) |
void | completeClassData (const RecordDecl *RD) |
void | completeClass (const RecordDecl *RD) |
void | completeTemplateDefinition (const ClassTemplateSpecializationDecl &SD) |
void | completeUnusedClass (const CXXRecordDecl &D) |
llvm::DIMacro * | CreateMacro (llvm::DIMacroFile *Parent, unsigned MType, SourceLocation LineLoc, StringRef Name, StringRef Value) |
Create debug info for a macro defined by a #define directive or a macro undefined by a #undef directive. More... | |
llvm::DIMacroFile * | CreateTempMacroFile (llvm::DIMacroFile *Parent, SourceLocation LineLoc, SourceLocation FileLoc) |
Create debug info for a file referenced by an include directive. More... | |
Param2DILocTy & | getParamDbgMappings () |
ParamDecl2StmtTy & | getCoroutineParameterMappings () |
void | setDwoId (uint64_t Signature) |
Module debugging: Support for building PCMs. More... | |
void | setModuleMap (ModuleMap &MMap) |
When generating debug information for a clang module or precompiled header, this module map will be used to determine the module of origin of each Decl. More... | |
void | setPCHDescriptor (ASTSourceDescriptor PCH) |
When generating debug information for a clang module or precompiled header, this module map will be used to determine the module of origin of each Decl. More... | |
Friends | |
class | ApplyDebugLocation |
class | SaveAndRestoreLocation |
This class gathers all debug information during compilation and is responsible for emitting to llvm globals or pass directly to the backend.
Definition at line 56 of file CGDebugInfo.h.
CGDebugInfo::CGDebugInfo | ( | CodeGenModule & | CGM | ) |
Definition at line 66 of file CGDebugInfo.cpp.
References clang::CodeGenOptions::DebugPrefixMap, and clang::CodeGen::CodeGenModule::getCodeGenOpts().
CGDebugInfo::~CGDebugInfo | ( | ) |
Definition at line 75 of file CGDebugInfo.cpp.
void CGDebugInfo::addHeapAllocSiteMetadata | ( | llvm::CallBase * | CallSite, |
QualType | AllocatedTy, | ||
SourceLocation | Loc | ||
) |
Add heapallocsite metadata for MSAllocator calls.
Definition at line 2243 of file CGDebugInfo.cpp.
References clang::codegenoptions::DebugLineTablesOnly, clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::Type::isVoidType(), and clang::transformer::node().
Referenced by clang::CodeGen::CodeGenFunction::EmitCall(), and clang::CodeGen::CodeGenFunction::EmitCXXNewExpr().
void CGDebugInfo::completeClass | ( | const RecordDecl * | RD | ) |
Definition at line 2333 of file CGDebugInfo.cpp.
References clang::Type::castAs(), clang::codegenoptions::DebugLineTablesOnly, clang::QualType::getAsOpaquePtr(), clang::CodeGen::CodeGenModule::getContext(), and clang::ASTContext::getRecordType().
Referenced by completeClassData().
void CGDebugInfo::completeClassData | ( | const RecordDecl * | RD | ) |
Definition at line 2319 of file CGDebugInfo.cpp.
References completeClass(), clang::RecordDecl::getDefinition(), clang::CodeGen::CodeGenModule::getVTableLinkage(), isClassOrMethodDLLImport(), and isDefinedInClangModule().
Referenced by completeRequiredType(), and completeUnusedClass().
void CGDebugInfo::completeRequiredType | ( | const RecordDecl * | RD | ) |
Definition at line 2432 of file CGDebugInfo.cpp.
References completeClassData(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::ASTContext::getRecordType(), and shouldOmitDefinition().
Referenced by completeType().
void CGDebugInfo::completeTemplateDefinition | ( | const ClassTemplateSpecializationDecl & | SD | ) |
Definition at line 3216 of file CGDebugInfo.cpp.
References completeUnusedClass().
void CGDebugInfo::completeType | ( | const EnumDecl * | ED | ) |
Definition at line 2258 of file CGDebugInfo.cpp.
References clang::Type::castAs(), clang::codegenoptions::DebugLineTablesOnly, clang::QualType::getAsOpaquePtr(), clang::CodeGen::CodeGenModule::getContext(), and clang::ASTContext::getEnumType().
void CGDebugInfo::completeType | ( | const RecordDecl * | RD | ) |
Definition at line 2271 of file CGDebugInfo.cpp.
References completeRequiredType(), clang::CodeGen::CodeGenModule::getLangOpts(), and clang::codegenoptions::LimitedDebugInfo.
void CGDebugInfo::completeUnusedClass | ( | const CXXRecordDecl & | D | ) |
Definition at line 3221 of file CGDebugInfo.cpp.
References completeClassData(), clang::codegenoptions::DebugLineTablesOnly, clang::QualType::getAsOpaquePtr(), clang::CodeGen::CodeGenModule::getContext(), and clang::ASTContext::getRecordType().
Referenced by completeTemplateDefinition().
llvm::DIMacro * CGDebugInfo::CreateMacro | ( | llvm::DIMacroFile * | Parent, |
unsigned | MType, | ||
SourceLocation | LineLoc, | ||
StringRef | Name, | ||
StringRef | Value | ||
) |
Create debug info for a macro defined by a #define directive or a macro undefined by a #undef directive.
Definition at line 3124 of file CGDebugInfo.cpp.
Referenced by clang::MacroPPCallbacks::MacroUndefined().
llvm::DIMacroFile * CGDebugInfo::CreateTempMacroFile | ( | llvm::DIMacroFile * | Parent, |
SourceLocation | LineLoc, | ||
SourceLocation | FileLoc | ||
) |
Create debug info for a file referenced by an include directive.
Definition at line 3131 of file CGDebugInfo.cpp.
References clang::SourceLocation::isInvalid(), Line, and Parent.
void CGDebugInfo::EmitAndRetainType | ( | QualType | Ty | ) |
Emit the type even if it might not be used.
Definition at line 5133 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), and clang::CodeGenOptions::hasMaybeUnusedDebugInfo().
llvm::DILocalVariable * CGDebugInfo::EmitDeclareOfArgVariable | ( | const VarDecl * | Decl, |
llvm::Value * | AI, | ||
unsigned | ArgNo, | ||
CGBuilderTy & | Builder | ||
) |
Emit call to llvm.dbg.declare
for an argument variable declaration.
Definition at line 4539 of file CGDebugInfo.cpp.
llvm::DILocalVariable * CGDebugInfo::EmitDeclareOfAutoVariable | ( | const VarDecl * | Decl, |
llvm::Value * | AI, | ||
CGBuilderTy & | Builder, | ||
const bool | UsePointerValue = false |
||
) |
Emit call to llvm.dbg.declare
for an automatic variable declaration.
Returns a pointer to the DILocalVariable associated with the llvm.dbg.declare, or nullptr otherwise.
Definition at line 4424 of file CGDebugInfo.cpp.
void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable | ( | const VarDecl * | variable, |
llvm::Value * | storage, | ||
CGBuilderTy & | Builder, | ||
const CGBlockInfo & | blockInfo, | ||
llvm::Instruction * | InsertPoint = nullptr |
||
) |
Emit call to llvm.dbg.declare
for an imported variable declaration in a block.
Definition at line 4466 of file CGDebugInfo.cpp.
void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable | ( | const CGBlockInfo & | block, |
StringRef | Name, | ||
unsigned | ArgNo, | ||
llvm::AllocaInst * | LocalAddr, | ||
CGBuilderTy & | Builder | ||
) |
Emit call to llvm.dbg.declare
for the block-literal argument to a block invocation function.
Definition at line 4593 of file CGDebugInfo.cpp.
void CGDebugInfo::EmitExplicitCastType | ( | QualType | Ty | ) |
Emit the type explicitly casted to.
Definition at line 5127 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), and clang::CodeGenOptions::hasReducedDebugInfo().
void CGDebugInfo::EmitExternalVariable | ( | llvm::GlobalVariable * | GV, |
const VarDecl * | Decl | ||
) |
Emit information about an external variable.
Definition at line 4922 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), getDeclAlignIfRequired(), clang::Decl::getLocation(), clang::Decl::hasAttr(), and clang::CodeGenOptions::hasReducedDebugInfo().
void CGDebugInfo::EmitFuncDeclForCallSite | ( | llvm::CallBase * | CallOrInvoke, |
QualType | CalleeType, | ||
const FunctionDecl * | CalleeDecl | ||
) |
Emit debug info for an extern function being called.
This is needed for call site debug info.
Definition at line 4042 of file CGDebugInfo.cpp.
References EmitFunctionDecl(), clang::FunctionDecl::getBuiltinID(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::Decl::hasAttr(), Id, clang::FunctionDecl::isInlined(), and clang::FunctionDecl::isStatic().
void CGDebugInfo::EmitFunctionDecl | ( | GlobalDecl | GD, |
SourceLocation | Loc, | ||
QualType | FnType, | ||
llvm::Function * | Fn = nullptr |
||
) |
Emit debug info for a function declaration.
Fn
is set only when a declaration for a debug call site gets created.
Definition at line 3982 of file CGDebugInfo.cpp.
Referenced by EmitFuncDeclForCallSite().
void CGDebugInfo::EmitFunctionEnd | ( | CGBuilderTy & | Builder, |
llvm::Function * | Fn | ||
) |
Constructs the debug code for exiting a function.
Definition at line 4158 of file CGDebugInfo.cpp.
void CGDebugInfo::emitFunctionStart | ( | GlobalDecl | GD, |
SourceLocation | Loc, | ||
SourceLocation | ScopeLoc, | ||
QualType | FnType, | ||
llvm::Function * | Fn, | ||
bool | CurFnIsThunk | ||
) |
Emit a call to llvm.dbg.function.start to indicate start of a new function.
Loc | The location of the function header. |
ScopeLoc | The location of the function body. |
Definition at line 3881 of file CGDebugInfo.cpp.
Emit a constant global variable's debug info.
Definition at line 4833 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::Decl::hasAttr(), clang::CodeGenOptions::hasReducedDebugInfo(), and string().
void CGDebugInfo::EmitGlobalVariable | ( | llvm::GlobalVariable * | GV, |
const VarDecl * | Decl | ||
) |
Emit information about a global variable.
Definition at line 4763 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::Decl::hasAttr(), clang::CodeGenOptions::hasReducedDebugInfo(), and string().
Referenced by clang::CodeGen::CodeGenFunction::EmitStaticVarDecl().
void CGDebugInfo::EmitImportDecl | ( | const ImportDecl & | ID | ) |
Emit an @import declaration.
Definition at line 4990 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts().
void CGDebugInfo::EmitInlineFunctionEnd | ( | CGBuilderTy & | Builder | ) |
End an inlined function scope.
Definition at line 4087 of file CGDebugInfo.cpp.
Referenced by clang::CodeGen::ApplyInlineDebugLocation::~ApplyInlineDebugLocation().
void CGDebugInfo::EmitInlineFunctionStart | ( | CGBuilderTy & | Builder, |
GlobalDecl | GD | ||
) |
Start a new scope for an inlined function.
Definition at line 4072 of file CGDebugInfo.cpp.
void CGDebugInfo::EmitLabel | ( | const LabelDecl * | D, |
CGBuilderTy & | Builder | ||
) |
Emit call to llvm.dbg.label
for an label.
Definition at line 4431 of file CGDebugInfo.cpp.
void CGDebugInfo::EmitLexicalBlockEnd | ( | CGBuilderTy & | Builder, |
SourceLocation | Loc | ||
) |
Emit metadata to indicate the end of a new lexical block and pop the current block.
Definition at line 4145 of file CGDebugInfo.cpp.
void CGDebugInfo::EmitLexicalBlockStart | ( | CGBuilderTy & | Builder, |
SourceLocation | Loc | ||
) |
Emit metadata to indicate the beginning of a new lexical block and push the block onto the stack.
Definition at line 4128 of file CGDebugInfo.cpp.
void CGDebugInfo::EmitLocation | ( | CGBuilderTy & | Builder, |
SourceLocation | Loc | ||
) |
Emit metadata to indicate a change in line/column information in the source file.
If the location is invalid, the previous location will be reused.
Definition at line 4093 of file CGDebugInfo.cpp.
llvm::DIImportedEntity * CGDebugInfo::EmitNamespaceAlias | ( | const NamespaceAliasDecl & | NA | ) |
Emit C++ namespace alias.
Definition at line 5004 of file CGDebugInfo.cpp.
References clang::NamespaceAliasDecl::getAliasedNamespace(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::Decl::getDeclContext(), clang::Decl::getLocation(), clang::NamedDecl::getName(), and clang::CodeGenOptions::hasReducedDebugInfo().
void CGDebugInfo::EmitUsingDecl | ( | const UsingDecl & | UD | ) |
Emit C++ using declaration.
Definition at line 4963 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::Type::getContainedAutoType(), clang::Decl::getDeclContext(), clang::Decl::getLocation(), clang::NamedDecl::getUnderlyingDecl(), clang::CodeGenOptions::hasReducedDebugInfo(), clang::UsingDecl::shadow_begin(), clang::UsingDecl::shadow_size(), and clang::Target.
void CGDebugInfo::EmitUsingDirective | ( | const UsingDirectiveDecl & | UD | ) |
Emit C++ using directive.
Definition at line 4948 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::Decl::getDeclContext(), clang::Decl::getLocation(), clang::UsingDirectiveDecl::getNominatedNamespace(), clang::CodeGenOptions::hasReducedDebugInfo(), clang::NamespaceDecl::isAnonymousNamespace(), and clang::SourceLocation::isValid().
void CGDebugInfo::finalize | ( | ) |
Definition at line 5050 of file CGDebugInfo.cpp.
References clang::QualType::getAsOpaquePtr(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), and P.
|
inline |
Definition at line 548 of file CGDebugInfo.h.
|
inline |
Definition at line 410 of file CGDebugInfo.h.
|
inline |
Return the current source location.
This does not necessarily correspond to the IRBuilder's current DebugLoc.
Definition at line 403 of file CGDebugInfo.h.
llvm::DIType * CGDebugInfo::getOrCreateInterfaceType | ( | QualType | Ty, |
SourceLocation | Loc | ||
) |
Emit an Objective-C interface type standalone debug info.
Definition at line 2227 of file CGDebugInfo.cpp.
References getOrCreateStandaloneType().
llvm::DIType * CGDebugInfo::getOrCreateRecordType | ( | QualType | Ty, |
SourceLocation | L | ||
) |
Emit record type's standalone debug info.
Definition at line 2220 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), and clang::CodeGenOptions::hasReducedDebugInfo().
Referenced by clang::CodeGen::CodeGenFunction::EmitLValueForField().
llvm::DIType * CGDebugInfo::getOrCreateStandaloneType | ( | QualType | Ty, |
SourceLocation | Loc | ||
) |
Emit standalone debug info for a type.
Definition at line 2232 of file CGDebugInfo.cpp.
References clang::QualType::getAsOpaquePtr(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGenOptions::hasReducedDebugInfo(), and clang::QualType::isNull().
Referenced by emitArraySubscriptGEP(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), emitPreserveStructAccess(), and getOrCreateInterfaceType().
|
inline |
Definition at line 547 of file CGDebugInfo.h.
|
inline |
Register VLA size expression debug node with the qualified type.
Definition at line 377 of file CGDebugInfo.h.
std::string CGDebugInfo::remapDIPath | ( | StringRef | Path | ) | const |
Remap a given path with the current debug prefix map.
Definition at line 480 of file CGDebugInfo.cpp.
References P.
void CGDebugInfo::setDwoId | ( | uint64_t | Signature | ) |
Module debugging: Support for building PCMs.
Set the main CU's DwoId field to Signature
.
Definition at line 5045 of file CGDebugInfo.cpp.
|
inline |
Update the current inline scope.
All subsequent calls to EmitLocation
will create a location with this inlinedAt field.
Definition at line 407 of file CGDebugInfo.h.
void CGDebugInfo::setLocation | ( | SourceLocation | Loc | ) |
Update the current source location.
If
Definition at line 170 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getContext(), clang::SourceManager::getExpansionLoc(), clang::ASTContext::getSourceManager(), clang::SourceLocation::isInvalid(), clang::PresumedLoc::isInvalid(), and SM.
Referenced by clang::CodeGen::CodeGenFunction::EmitStaticVarDecl().
|
inline |
When generating debug information for a clang module or precompiled header, this module map will be used to determine the module of origin of each Decl.
Definition at line 389 of file CGDebugInfo.h.
|
inline |
When generating debug information for a clang module or precompiled header, this module map will be used to determine the module of origin of each Decl.
Definition at line 394 of file CGDebugInfo.h.
References clang::PCH.
llvm::DebugLoc CGDebugInfo::SourceLocToDebugLoc | ( | SourceLocation | Loc | ) |
Definition at line 5139 of file CGDebugInfo.cpp.
References clang::CodeGen::CodeGenModule::getLLVMContext().
|
friend |
Definition at line 57 of file CGDebugInfo.h.
|
friend |
Definition at line 58 of file CGDebugInfo.h.