mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
Fix debug info for cleanup block.
llvm-svn: 101100
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
21
clang/test/CodeGenCXX/destructor-debug-info.cpp
Normal file
21
clang/test/CodeGenCXX/destructor-debug-info.cpp
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user