[cfe-commits] r101100 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp lib/CodeGen/CodeGenFunction.cpp test/CodeGenCXX/destructor-debug-info.cpp
Devang Patel
dpatel at apple.com
Mon Apr 12 17:08:44 PDT 2010
Author: dpatel
Date: Mon Apr 12 19:08:43 2010
New Revision: 101100
URL: http://llvm.org/viewvc/llvm-project?rev=101100&view=rev
Log:
Fix debug info for cleanup block.
Added:
cfe/trunk/test/CodeGenCXX/destructor-debug-info.cpp
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=101100&r1=101099&r2=101100&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Apr 12 19:08:43 2010
@@ -160,7 +160,7 @@
EmitStmt(*I);
if (DI) {
- DI->setLocation(S.getLBracLoc());
+ DI->setLocation(S.getRBracLoc());
DI->EmitRegionEnd(CurFn, Builder);
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=101100&r1=101099&r2=101100&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Mon Apr 12 19:08:43 2010
@@ -749,6 +749,11 @@
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) {
Added: cfe/trunk/test/CodeGenCXX/destructor-debug-info.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/destructor-debug-info.cpp?rev=101100&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/destructor-debug-info.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/destructor-debug-info.cpp Mon Apr 12 19:08:43 2010
@@ -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);
+ }
+}
More information about the cfe-commits
mailing list