diff options
author | Devang Patel <dpatel@apple.com> | 2010-02-16 21:41:20 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-02-16 21:41:20 +0000 |
commit | d19429f01a4169b573cafa466dd7a09a51e5fd92 (patch) | |
tree | 390758b1e7364281d7868ef32f4b13c2de15cfe5 | |
parent | e873fb74219f48407ae0b8fa083aa7f0b6ff1427 (diff) |
Distinguish two lexical blocks at the same level.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96397 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 5 | ||||
-rw-r--r-- | test/CodeGen/2010-02-16-DbgScopes.c | 18 |
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 5b9c6b055e..3a27a37988 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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()); } diff --git a/test/CodeGen/2010-02-16-DbgScopes.c b/test/CodeGen/2010-02-16-DbgScopes.c new file mode 100644 index 0000000000..b11f920156 --- /dev/null +++ b/test/CodeGen/2010-02-16-DbgScopes.c @@ -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; + } + } +} |