forked from OSchip/llvm-project
Distinguish two lexical blocks at the same level.
llvm-svn: 96397
This commit is contained in:
parent
b154fdc974
commit
7585580ccc
|
@ -1351,10 +1351,13 @@ void CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder) {
|
|||
/// EmitRegionStart- Constructs the debug code for entering a declarative
|
||||
/// region - "llvm.dbg.region.start.".
|
||||
void CGDebugInfo::EmitRegionStart(llvm::Function *Fn, CGBuilderTy &Builder) {
|
||||
SourceManager &SM = CGM.getContext().getSourceManager();
|
||||
PresumedLoc PLoc = SM.getPresumedLoc(CurLoc);
|
||||
llvm::DIDescriptor D =
|
||||
DebugFactory.CreateLexicalBlock(RegionStack.empty() ?
|
||||
llvm::DIDescriptor() :
|
||||
llvm::DIDescriptor(RegionStack.back()));
|
||||
llvm::DIDescriptor(RegionStack.back()),
|
||||
PLoc.getLine(), PLoc.getColumn());
|
||||
RegionStack.push_back(D.getNode());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -emit-llvm -g < %s | grep lexical | count 5
|
||||
// Test to check number of lexical scope identified in debug info.
|
||||
|
||||
extern int bar();
|
||||
extern void foobar();
|
||||
void foo(int s) {
|
||||
unsigned loc = 0;
|
||||
if (s) {
|
||||
if (bar()) {
|
||||
foobar();
|
||||
}
|
||||
} else {
|
||||
loc = 1;
|
||||
if (bar()) {
|
||||
loc = 2;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue