aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-10-06 18:36:08 +0000
committerDevang Patel <dpatel@apple.com>2009-10-06 18:36:08 +0000
commitbbd9fa4b4a0fea47f94ac3eb4eaf5cc8079defe1 (patch)
treee5e7cb17543843e953ab3c90a5e9bd13cbf0375f /lib/CodeGen/CGDebugInfo.cpp
parent65705d1d76bd4edca324a52eaf27ecb6e6a8151c (diff)
Add support to attach debug info to an instruction.
This is not yet enabled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index be742d9b80..de9390eb9f 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -879,7 +879,7 @@ void CGDebugInfo::EmitFunctionStart(const char *Name, QualType ReturnType,
getOrCreateType(ReturnType, Unit),
Fn->hasInternalLinkage(), true/*definition*/);
- DebugFactory.InsertSubprogramStart(SP, Builder.GetInsertBlock());
+// DebugFactory.InsertSubprogramStart(SP, Builder.GetInsertBlock());
// Push function on region stack.
RegionStack.push_back(SP);
@@ -903,8 +903,19 @@ void CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder) {
// Get the appropriate compile unit.
llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);
PresumedLoc PLoc = SM.getPresumedLoc(CurLoc);
+
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+ llvm::DIDescriptor DR = RegionStack.back();
+ llvm::DIScope DS = llvm::DIScope(DR.getNode());
+ llvm::DILocation DO(NULL);
+ llvm::DILocation DL =
+ DebugFactory.CreateLocation(PLoc.getLine(), PLoc.getColumn(),
+ DS, DO);
+ Builder.SetCurrentDebugLocation(DL.getNode());
+#else
DebugFactory.InsertStopPoint(Unit, PLoc.getLine(), PLoc.getColumn(),
Builder.GetInsertBlock());
+#endif
}
/// EmitRegionStart- Constructs the debug code for entering a declarative
@@ -915,7 +926,9 @@ void CGDebugInfo::EmitRegionStart(llvm::Function *Fn, CGBuilderTy &Builder) {
D = RegionStack.back();
D = DebugFactory.CreateLexicalBlock(D);
RegionStack.push_back(D);
+#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
DebugFactory.InsertRegionStart(D, Builder.GetInsertBlock());
+#endif
}
/// EmitRegionEnd - Constructs the debug code for exiting a declarative
@@ -926,7 +939,9 @@ void CGDebugInfo::EmitRegionEnd(llvm::Function *Fn, CGBuilderTy &Builder) {
// Provide an region stop point.
EmitStopPoint(Fn, Builder);
+#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
DebugFactory.InsertRegionEnd(RegionStack.back(), Builder.GetInsertBlock());
+#endif
RegionStack.pop_back();
}