aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.h')
-rw-r--r--lib/CodeGen/CGDebugInfo.h56
1 files changed, 41 insertions, 15 deletions
diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h
index de655800fa08..0a617b999240 100644
--- a/lib/CodeGen/CGDebugInfo.h
+++ b/lib/CodeGen/CGDebugInfo.h
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This is the source level debug info generator for llvm translation.
+// This is the source level debug info generator for llvm translation.
//
//===----------------------------------------------------------------------===//
@@ -15,28 +15,35 @@
#define CLANG_CODEGEN_CGDEBUGINFO_H
#include "clang/AST/Type.h"
+#include "clang/AST/Expr.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Analysis/DebugInfo.h"
+#include "llvm/Support/ValueHandle.h"
#include <map>
#include "CGBuilder.h"
+namespace llvm {
+ class MDNode;
+}
+
namespace clang {
class VarDecl;
class ObjCInterfaceDecl;
namespace CodeGen {
class CodeGenModule;
+ class CodeGenFunction;
-/// CGDebugInfo - This class gathers all debug information during compilation
-/// and is responsible for emitting to llvm globals or pass directly to
+/// CGDebugInfo - This class gathers all debug information during compilation
+/// and is responsible for emitting to llvm globals or pass directly to
/// the backend.
class CGDebugInfo {
CodeGenModule *M;
bool isMainCompileUnitCreated;
llvm::DIFactory DebugFactory;
-
+
SourceLocation CurLoc, PrevLoc;
/// CompileUnitCache - Cache of previously constructed CompileUnits.
@@ -44,8 +51,8 @@ class CGDebugInfo {
/// TypeCache - Cache of previously constructed Types.
// FIXME: Eliminate this map. Be careful of iterator invalidation.
- std::map<void *, llvm::DIType> TypeCache;
-
+ std::map<void *, llvm::WeakVH> TypeCache;
+
bool BlockLiteralGenericSet;
llvm::DIType BlockLiteralGeneric;
@@ -54,8 +61,10 @@ class CGDebugInfo {
/// Helper functions for getOrCreateType.
llvm::DIType CreateType(const BuiltinType *Ty, llvm::DICompileUnit U);
llvm::DIType CreateType(const ComplexType *Ty, llvm::DICompileUnit U);
- llvm::DIType CreateCVRType(QualType Ty, llvm::DICompileUnit U);
+ llvm::DIType CreateQualifiedType(QualType Ty, llvm::DICompileUnit U);
llvm::DIType CreateType(const TypedefType *Ty, llvm::DICompileUnit U);
+ llvm::DIType CreateType(const ObjCObjectPointerType *Ty,
+ llvm::DICompileUnit Unit);
llvm::DIType CreateType(const PointerType *Ty, llvm::DICompileUnit U);
llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DICompileUnit U);
llvm::DIType CreateType(const FunctionType *Ty, llvm::DICompileUnit U);
@@ -81,12 +90,12 @@ public:
/// start of a new function.
void EmitFunctionStart(const char *Name, QualType ReturnType,
llvm::Function *Fn, CGBuilderTy &Builder);
-
+
/// EmitRegionStart - Emit a call to llvm.dbg.region.start to indicate start
- /// of a new block.
+ /// of a new block.
void EmitRegionStart(llvm::Function *Fn, CGBuilderTy &Builder);
-
- /// EmitRegionEnd - Emit call to llvm.dbg.region.end to indicate end of a
+
+ /// EmitRegionEnd - Emit call to llvm.dbg.region.end to indicate end of a
/// block.
void EmitRegionEnd(llvm::Function *Fn, CGBuilderTy &Builder);
@@ -95,23 +104,36 @@ public:
void EmitDeclareOfAutoVariable(const VarDecl *Decl, llvm::Value *AI,
CGBuilderTy &Builder);
+ /// EmitDeclareOfBlockDeclRefVariable - Emit call to llvm.dbg.declare for an
+ /// imported variable declaration in a block.
+ void EmitDeclareOfBlockDeclRefVariable(const BlockDeclRefExpr *BDRE,
+ llvm::Value *AI,
+ CGBuilderTy &Builder,
+ CodeGenFunction *CGF);
+
/// EmitDeclareOfArgVariable - Emit call to llvm.dbg.declare for an argument
/// variable declaration.
void EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI,
CGBuilderTy &Builder);
-
+
/// EmitGlobalVariable - Emit information about a global variable.
void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl);
/// EmitGlobalVariable - Emit information about an objective-c interface.
void EmitGlobalVariable(llvm::GlobalVariable *GV, ObjCInterfaceDecl *Decl);
-
+
private:
/// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
void EmitDeclare(const VarDecl *decl, unsigned Tag, llvm::Value *AI,
CGBuilderTy &Builder);
-
-
+
+ /// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
+ void EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag, llvm::Value *AI,
+ CGBuilderTy &Builder, CodeGenFunction *CGF);
+
+ /// getContext - Get context info for the decl.
+ llvm::DIDescriptor getContext(const VarDecl *Decl,llvm::DIDescriptor &CU);
+
/// getOrCreateCompileUnit - Get the compile unit from the cache or create a
/// new one if necessary.
llvm::DICompileUnit getOrCreateCompileUnit(SourceLocation Loc);
@@ -119,8 +141,12 @@ private:
/// getOrCreateType - Get the type from the cache or create a new type if
/// necessary.
llvm::DIType getOrCreateType(QualType Ty, llvm::DICompileUnit Unit);
+
+ /// CreateTypeNode - Create type metadata for a source language type.
+ llvm::DIType CreateTypeNode(QualType Ty, llvm::DICompileUnit Unit);
};
} // namespace CodeGen
} // namespace clang
+
#endif