summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-04-13 00:08:43 +0000
committerDevang Patel <dpatel@apple.com>2010-04-13 00:08:43 +0000
commit74c10507a6c9b0eb034ffe154a194de2088e7522 (patch)
tree1e11085efdae9b8acd30136b95aeccd1e8d8e76e
parent9d94f04f27304615381712fc836391d5f745e545 (diff)
downloadbcm5719-llvm-74c10507a6c9b0eb034ffe154a194de2088e7522.tar.gz
bcm5719-llvm-74c10507a6c9b0eb034ffe154a194de2088e7522.zip
Fix debug info for cleanup block.
llvm-svn: 101100
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp2
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp5
-rw-r--r--clang/test/CodeGenCXX/destructor-debug-info.cpp21
3 files changed, 27 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 6604b91db9f..07c96d82ca7 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -160,7 +160,7 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
EmitStmt(*I);
if (DI) {
- DI->setLocation(S.getLBracLoc());
+ DI->setLocation(S.getRBracLoc());
DI->EmitRegionEnd(CurFn, Builder);
}
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index f38d8a132f0..110a8dc812d 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -749,6 +749,11 @@ void CodeGenFunction::EmitCleanupBlock() {
return;
}
+ // Scrub debug location info.
+ for (llvm::BasicBlock::iterator LBI = Info.CleanupBlock->begin(),
+ LBE = Info.CleanupBlock->end(); LBI != LBE; ++LBI)
+ Builder.SetInstDebugLocation(LBI);
+
llvm::BasicBlock *CurBB = Builder.GetInsertBlock();
if (CurBB && !CurBB->getTerminator() &&
Info.CleanupBlock->getNumUses() == 0) {
diff --git a/clang/test/CodeGenCXX/destructor-debug-info.cpp b/clang/test/CodeGenCXX/destructor-debug-info.cpp
new file mode 100644
index 00000000000..9e32275d339
--- /dev/null
+++ b/clang/test/CodeGenCXX/destructor-debug-info.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -g -S -emit-llvm -o %t %s
+// RUN: grep "i32 20, i32 3, metadata" %t | count 1
+// Check there is a line number entry for line 20 where b1 is destructed.
+class A { int a; };
+class B {
+public:
+ B() { a = new A; }
+ ~B() { delete a; }
+private:
+ A *a;
+};
+
+void fn(B b);
+
+int i;
+void foo() {
+ if (i) {
+ B b1;
+ fn (b1);
+ }
+}
OpenPOWER on IntegriCloud