[cfe-commits] r96397 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/2010-02-16-DbgScopes.c
Devang Patel
dpatel at apple.com
Tue Feb 16 13:41:21 PST 2010
Author: dpatel
Date: Tue Feb 16 15:41:20 2010
New Revision: 96397
URL: http://llvm.org/viewvc/llvm-project?rev=96397&view=rev
Log:
Distinguish two lexical blocks at the same level.
Added:
cfe/trunk/test/CodeGen/2010-02-16-DbgScopes.c
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=96397&r1=96396&r2=96397&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 16 15:41:20 2010
@@ -1351,10 +1351,13 @@
/// 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());
}
Added: cfe/trunk/test/CodeGen/2010-02-16-DbgScopes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2010-02-16-DbgScopes.c?rev=96397&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/2010-02-16-DbgScopes.c (added)
+++ cfe/trunk/test/CodeGen/2010-02-16-DbgScopes.c Tue Feb 16 15:41:20 2010
@@ -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;
+ }
+ }
+}
More information about the cfe-commits
mailing list