clang  6.0.0svn
Classes | Public Member Functions | Friends | List of all members
clang::CodeGen::CGDebugInfo Class Reference

This class gathers all debug information during compilation and is responsible for emitting to llvm globals or pass directly to the backend. More...

#include "/opt/doxygen-docs/src/llvm/tools/clang/lib/CodeGen/CGDebugInfo.h"

Public Member Functions

 CGDebugInfo (CodeGenModule &CGM)
 
 ~CGDebugInfo ()
 
void finalize ()
 
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, CGBuilderTy &Builder)
 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)
 Emit debug info for a function declaration. 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...
 
void EmitDeclareOfAutoVariable (const VarDecl *Decl, llvm::Value *AI, CGBuilderTy &Builder)
 Emit call to llvm.dbg.declare for an automatic variable declaration. 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...
 
void 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 EmitUsingDirective (const UsingDirectiveDecl &UD)
 Emit C++ using directive. More...
 
void EmitExplicitCastType (QualType Ty)
 Emit the type explicitly casted to. More...
 
void EmitUsingDecl (const UsingDecl &UD)
 Emit C++ using declaration. More...
 
void EmitImportDecl (const ImportDecl &ID)
 Emit an 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 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...
 
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 (ExternalASTSource::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
 

Detailed Description

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 53 of file CGDebugInfo.h.

Constructor & Destructor Documentation

◆ CGDebugInfo()

CGDebugInfo::CGDebugInfo ( CodeGenModule CGM)

◆ ~CGDebugInfo()

CGDebugInfo::~CGDebugInfo ( )

Definition at line 73 of file CGDebugInfo.cpp.

Member Function Documentation

◆ completeClass()

void CGDebugInfo::completeClass ( const RecordDecl RD)

◆ completeClassData()

void CGDebugInfo::completeClassData ( const RecordDecl RD)

◆ completeRequiredType()

void CGDebugInfo::completeRequiredType ( const RecordDecl RD)

◆ completeTemplateDefinition()

void CGDebugInfo::completeTemplateDefinition ( const ClassTemplateSpecializationDecl SD)

Definition at line 2598 of file CGDebugInfo.cpp.

References clang::codegenoptions::DebugLineTablesOnly.

◆ completeType() [1/2]

void CGDebugInfo::completeType ( const EnumDecl ED)

◆ completeType() [2/2]

void CGDebugInfo::completeType ( const RecordDecl RD)

Definition at line 1784 of file CGDebugInfo.cpp.

References clang::codegenoptions::LimitedDebugInfo.

◆ completeUnusedClass()

void CGDebugInfo::completeUnusedClass ( const CXXRecordDecl D)

◆ CreateMacro()

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 2506 of file CGDebugInfo.cpp.

Referenced by clang::MacroPPCallbacks::MacroUndefined().

◆ CreateTempMacroFile()

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 2513 of file CGDebugInfo.cpp.

References clang::SourceLocation::isInvalid(), and Line.

◆ EmitDeclareOfArgVariable()

void 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 3675 of file CGDebugInfo.cpp.

References clang::codegenoptions::LimitedDebugInfo, and clang::operator<().

◆ EmitDeclareOfAutoVariable()

void CGDebugInfo::EmitDeclareOfAutoVariable ( const VarDecl Decl,
llvm::Value AI,
CGBuilderTy Builder 
)

Emit call to llvm.dbg.declare for an automatic variable declaration.

Definition at line 3589 of file CGDebugInfo.cpp.

References clang::codegenoptions::LimitedDebugInfo, and clang::None.

◆ EmitDeclareOfBlockDeclRefVariable()

void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable ( const VarDecl variable,
llvm::Value storage,
CGBuilderTy Builder,
const CGBlockInfo blockInfo,
llvm::Instruction *  InsertPoint = nullptr 
)

◆ EmitDeclareOfBlockLiteralArgVariable()

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 3692 of file CGDebugInfo.cpp.

◆ EmitExplicitCastType()

void CGDebugInfo::EmitExplicitCastType ( QualType  Ty)

Emit the type explicitly casted to.

Definition at line 4147 of file CGDebugInfo.cpp.

References clang::codegenoptions::LimitedDebugInfo.

◆ EmitFunctionDecl()

void CGDebugInfo::EmitFunctionDecl ( GlobalDecl  GD,
SourceLocation  Loc,
QualType  FnType 
)

Emit debug info for a function declaration.

Definition at line 3249 of file CGDebugInfo.cpp.

◆ EmitFunctionEnd()

void CGDebugInfo::EmitFunctionEnd ( CGBuilderTy Builder,
llvm::Function *  Fn 
)

Constructs the debug code for exiting a function.

Definition at line 3377 of file CGDebugInfo.cpp.

◆ EmitFunctionStart()

void CGDebugInfo::EmitFunctionStart ( GlobalDecl  GD,
SourceLocation  Loc,
SourceLocation  ScopeLoc,
QualType  FnType,
llvm::Function *  Fn,
CGBuilderTy Builder 
)

Emit a call to llvm.dbg.function.start to indicate start of a new function.

Parameters
LocThe location of the function header.
ScopeLocThe location of the function body.

Definition at line 3174 of file CGDebugInfo.cpp.

◆ EmitGlobalVariable() [1/2]

void CGDebugInfo::EmitGlobalVariable ( llvm::GlobalVariable *  GV,
const VarDecl Decl 
)

◆ EmitGlobalVariable() [2/2]

void CGDebugInfo::EmitGlobalVariable ( const ValueDecl VD,
const APValue Init 
)

Emit a constant global variable's debug info.

Definition at line 3930 of file CGDebugInfo.cpp.

References getDeclAlignIfRequired(), clang::Decl::getLocation(), clang::Decl::hasAttr(), and clang::codegenoptions::LimitedDebugInfo.

◆ EmitImportDecl()

void CGDebugInfo::EmitImportDecl ( const ImportDecl ID)

◆ EmitInlineFunctionEnd()

void CGDebugInfo::EmitInlineFunctionEnd ( CGBuilderTy Builder)

End an inlined function scope.

Definition at line 3306 of file CGDebugInfo.cpp.

Referenced by clang::CodeGen::ApplyInlineDebugLocation::~ApplyInlineDebugLocation().

◆ EmitInlineFunctionStart()

void CGDebugInfo::EmitInlineFunctionStart ( CGBuilderTy Builder,
GlobalDecl  GD 
)

Start a new scope for an inlined function.

Definition at line 3291 of file CGDebugInfo.cpp.

◆ EmitLexicalBlockEnd()

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 3364 of file CGDebugInfo.cpp.

◆ EmitLexicalBlockStart()

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 3347 of file CGDebugInfo.cpp.

◆ EmitLocation()

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 3312 of file CGDebugInfo.cpp.

◆ EmitNamespaceAlias()

llvm::DIImportedEntity * CGDebugInfo::EmitNamespaceAlias ( const NamespaceAliasDecl NA)

◆ EmitUsingDecl()

void CGDebugInfo::EmitUsingDecl ( const UsingDecl UD)

◆ EmitUsingDirective()

void CGDebugInfo::EmitUsingDirective ( const UsingDirectiveDecl UD)

◆ finalize()

void CGDebugInfo::finalize ( )

Definition at line 4095 of file CGDebugInfo.cpp.

◆ getInlinedAt()

llvm::MDNode* clang::CodeGen::CGDebugInfo::getInlinedAt ( ) const
inline
Returns
the current inline scope.

Definition at line 343 of file CGDebugInfo.h.

References clang::markup::EmitLocation().

◆ getLocation()

SourceLocation clang::CodeGen::CGDebugInfo::getLocation ( ) const
inline

Return the current source location.

This does not necessarily correspond to the IRBuilder's current DebugLoc.

Definition at line 336 of file CGDebugInfo.h.

◆ getOrCreateInterfaceType()

llvm::DIType * CGDebugInfo::getOrCreateInterfaceType ( QualType  Ty,
SourceLocation  Loc 
)

Emit an Objective-C interface type standalone debug info.

Definition at line 1755 of file CGDebugInfo.cpp.

◆ getOrCreateRecordType()

llvm::DIType * CGDebugInfo::getOrCreateRecordType ( QualType  Ty,
SourceLocation  L 
)

Emit record type's standalone debug info.

Definition at line 1748 of file CGDebugInfo.cpp.

References clang::codegenoptions::LimitedDebugInfo, and clang::T.

◆ getOrCreateStandaloneType()

llvm::DIType * CGDebugInfo::getOrCreateStandaloneType ( QualType  Ty,
SourceLocation  Loc 
)

Emit standalone debug info for a type.

Definition at line 1760 of file CGDebugInfo.cpp.

References clang::QualType::getAsOpaquePtr(), clang::QualType::isNull(), clang::codegenoptions::LimitedDebugInfo, and clang::T.

◆ setDwoId()

void CGDebugInfo::setDwoId ( uint64_t  Signature)

Module debugging: Support for building PCMs.

Set the main CU's DwoId field to Signature.

Definition at line 4089 of file CGDebugInfo.cpp.

◆ setInlinedAt()

void clang::CodeGen::CGDebugInfo::setInlinedAt ( llvm::MDNode *  InlinedAt)
inline

Update the current inline scope.

All subsequent calls to EmitLocation will create a location with this inlinedAt field.

Definition at line 340 of file CGDebugInfo.h.

◆ setLocation()

void CGDebugInfo::setLocation ( SourceLocation  Loc)

Update the current source location.

If

  • loc is invalid it is ignored.

Definition at line 167 of file CGDebugInfo.cpp.

References clang::Decl::getDeclContext(), clang::SourceManager::getPresumedLoc(), clang::SourceLocation::isInvalid(), and SM.

Referenced by clang::CodeGen::CodeGenFunction::EmitStaticVarDecl().

◆ setModuleMap()

void clang::CodeGen::CGDebugInfo::setModuleMap ( ModuleMap MMap)
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 320 of file CGDebugInfo.h.

◆ setPCHDescriptor()

void clang::CodeGen::CGDebugInfo::setPCHDescriptor ( ExternalASTSource::ASTSourceDescriptor  PCH)
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 325 of file CGDebugInfo.h.

◆ SourceLocToDebugLoc()

llvm::DebugLoc CGDebugInfo::SourceLocToDebugLoc ( SourceLocation  Loc)

Definition at line 4156 of file CGDebugInfo.cpp.

Friends And Related Function Documentation

◆ ApplyDebugLocation

friend class ApplyDebugLocation
friend

Definition at line 54 of file CGDebugInfo.h.

◆ SaveAndRestoreLocation

friend class SaveAndRestoreLocation
friend

Definition at line 55 of file CGDebugInfo.h.


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