LLVM  7.0.0svn
Macros | Functions
DebugInfo.cpp File Reference
#include "llvm-c/DebugInfo.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GVMaterializer.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Casting.h"
#include <algorithm>
#include <cassert>
#include <utility>
#include "llvm/BinaryFormat/Dwarf.def"
Include dependency graph for DebugInfo.cpp:

Go to the source code of this file.

Macros

#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR)   case LLVMDWARFSourceLanguage##NAME: return ID;
 

Functions

static MDNodestripDebugLocFromLoopID (MDNode *N)
 
static unsigned map_from_llvmDWARFsourcelanguage (LLVMDWARFSourceLanguage lang)
 
unsigned LLVMDebugMetadataVersion ()
 The current debug metadata version number. More...
 
LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved (LLVMModuleRef M)
 Construct a builder for a module, and do not allow for unresolved nodes attached to the module. More...
 
LLVMDIBuilderRef LLVMCreateDIBuilder (LLVMModuleRef M)
 Construct a builder for a module and collect unresolved nodes attached to the module in order to resolve cycles during a call to LLVMDIBuilderFinalize. More...
 
unsigned LLVMGetModuleDebugMetadataVersion (LLVMModuleRef M)
 The version of debug metadata that's present in the provided Module. More...
 
LLVMBool LLVMStripModuleDebugInfo (LLVMModuleRef M)
 Strip debug info in the module if it exists. More...
 
void LLVMDisposeDIBuilder (LLVMDIBuilderRef Builder)
 Deallocates the DIBuilder and everything it owns. More...
 
void LLVMDIBuilderFinalize (LLVMDIBuilderRef Builder)
 Construct any deferred debug info descriptors. More...
 
LLVMMetadataRef LLVMDIBuilderCreateCompileUnit (LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang, LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen, LLVMBool isOptimized, const char *Flags, size_t FlagsLen, unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen, LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining, LLVMBool DebugInfoForProfiling)
 A CompileUnit provides an anchor for all debugging information generated during this instance of compilation. More...
 
LLVMMetadataRef LLVMDIBuilderCreateFile (LLVMDIBuilderRef Builder, const char *Filename, size_t FilenameLen, const char *Directory, size_t DirectoryLen)
 Create a file descriptor to hold debugging information for a file. More...
 
LLVMMetadataRef LLVMDIBuilderCreateDebugLocation (LLVMContextRef Ctx, unsigned Line, unsigned Column, LLVMMetadataRef Scope, LLVMMetadataRef InlinedAt)
 Creates a new DebugLocation that describes a source location. More...
 

Macro Definition Documentation

◆ HANDLE_DW_LANG

#define HANDLE_DW_LANG (   ID,
  NAME,
  VERSION,
  VENDOR 
)    case LLVMDWARFSourceLanguage##NAME: return ID;

Function Documentation

◆ LLVMCreateDIBuilder()

LLVMDIBuilderRef LLVMCreateDIBuilder ( LLVMModuleRef  M)

Construct a builder for a module and collect unresolved nodes attached to the module in order to resolve cycles during a call to LLVMDIBuilderFinalize.

Definition at line 703 of file DebugInfo.cpp.

References llvm::unwrap(), and llvm::wrap().

◆ LLVMCreateDIBuilderDisallowUnresolved()

LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved ( LLVMModuleRef  M)

Construct a builder for a module, and do not allow for unresolved nodes attached to the module.

Definition at line 699 of file DebugInfo.cpp.

References llvm::unwrap(), and llvm::wrap().

◆ LLVMDebugMetadataVersion()

unsigned LLVMDebugMetadataVersion ( void  )

The current debug metadata version number.

Definition at line 695 of file DebugInfo.cpp.

References llvm::DEBUG_METADATA_VERSION.

◆ LLVMDIBuilderCreateCompileUnit()

LLVMMetadataRef LLVMDIBuilderCreateCompileUnit ( LLVMDIBuilderRef  Builder,
LLVMDWARFSourceLanguage  Lang,
LLVMMetadataRef  FileRef,
const char Producer,
size_t  ProducerLen,
LLVMBool  isOptimized,
const char Flags,
size_t  FlagsLen,
unsigned  RuntimeVer,
const char SplitName,
size_t  SplitNameLen,
LLVMDWARFEmissionKind  Kind,
unsigned  DWOId,
LLVMBool  SplitDebugInlining,
LLVMBool  DebugInfoForProfiling 
)

A CompileUnit provides an anchor for all debugging information generated during this instance of compilation.

Parameters
LangSource programming language, eg. LLVMDWARFSourceLanguageC99
FileRefFile info.
ProducerIdentify the producer of debugging information and code. Usually this is a compiler version string.
ProducerLenThe length of the C string passed to Producer.
isOptimizedA boolean flag which indicates whether optimization is enabled or not.
FlagsThis string lists command line options. This string is directly embedded in debug info output which may be used by a tool analyzing generated debugging information.
FlagsLenThe length of the C string passed to Flags.
RuntimeVerThis indicates runtime version for languages like Objective-C.
SplitNameThe name of the file that we'll split debug info out into.
SplitNameLenThe length of the C string passed to SplitName.
KindThe kind of debug information to generate.
DWOIdThe DWOId if this is a split skeleton compile unit.
SplitDebugInliningWhether to emit inline debug info.
DebugInfoForProfilingWhether to emit extra debug info for profile collection.

Definition at line 723 of file DebugInfo.cpp.

References llvm::ARMBuildAttrs::File, map_from_llvmDWARFsourcelanguage(), llvm::unwrap(), and llvm::wrap().

◆ LLVMDIBuilderCreateDebugLocation()

LLVMMetadataRef LLVMDIBuilderCreateDebugLocation ( LLVMContextRef  Ctx,
unsigned  Line,
unsigned  Column,
LLVMMetadataRef  Scope,
LLVMMetadataRef  InlinedAt 
)

Creates a new DebugLocation that describes a source location.

Parameters
LineThe line in the source file.
ColumnThe column in the source file.
ScopeThe scope in which the location resides.
InlinedAtThe scope where this location was inlined, if at all. (optional).
Note
If the item to which this location is attached cannot be attributed to a source line, pass 0 for the line and column.

Definition at line 750 of file DebugInfo.cpp.

References llvm::MDNode::get(), llvm::unwrap(), and llvm::wrap().

◆ LLVMDIBuilderCreateFile()

LLVMMetadataRef LLVMDIBuilderCreateFile ( LLVMDIBuilderRef  Builder,
const char Filename,
size_t  FilenameLen,
const char Directory,
size_t  DirectoryLen 
)

Create a file descriptor to hold debugging information for a file.

Parameters
BuilderThe DIBuilder.
FilenameFile name.
FilenameLenThe length of the C string passed to Filename.
DirectoryDirectory.
DirectoryLenThe length of the C string passed to Directory.

Definition at line 742 of file DebugInfo.cpp.

References llvm::unwrap(), and llvm::wrap().

◆ LLVMDIBuilderFinalize()

void LLVMDIBuilderFinalize ( LLVMDIBuilderRef  Builder)

Construct any deferred debug info descriptors.

Definition at line 719 of file DebugInfo.cpp.

References llvm::unwrap().

◆ LLVMDisposeDIBuilder()

void LLVMDisposeDIBuilder ( LLVMDIBuilderRef  Builder)

Deallocates the DIBuilder and everything it owns.

Note
You must call LLVMDIBuilderFinalize before this

Definition at line 715 of file DebugInfo.cpp.

References llvm::unwrap().

◆ LLVMGetModuleDebugMetadataVersion()

unsigned LLVMGetModuleDebugMetadataVersion ( LLVMModuleRef  M)

The version of debug metadata that's present in the provided Module.

Definition at line 707 of file DebugInfo.cpp.

References llvm::getDebugMetadataVersionFromModule(), and llvm::unwrap().

◆ LLVMStripModuleDebugInfo()

LLVMBool LLVMStripModuleDebugInfo ( LLVMModuleRef  Module)

Strip debug info in the module if it exists.

To do this, we remove all calls to the debugger intrinsics and any named metadata for debugging. We also remove debug locations for instructions. Return true if module is modified.

Definition at line 711 of file DebugInfo.cpp.

References llvm::StripDebugInfo(), and llvm::unwrap().

◆ map_from_llvmDWARFsourcelanguage()

static unsigned map_from_llvmDWARFsourcelanguage ( LLVMDWARFSourceLanguage  lang)
static

Definition at line 685 of file DebugInfo.cpp.

References llvm_unreachable.

Referenced by LLVMDIBuilderCreateCompileUnit().

◆ stripDebugLocFromLoopID()

static MDNode* stripDebugLocFromLoopID ( MDNode N)
static