]> granicus.if.org Git - clang/commitdiff
While handling change of file, check if _current_ file is already seen or not. If...
authorDevang Patel <dpatel@apple.com>
Wed, 15 Sep 2010 20:50:40 +0000 (20:50 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 15 Sep 2010 20:50:40 +0000 (20:50 +0000)
This fixes radar 8396182.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114018 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGen/debug-info-line.c [new file with mode: 0644]

index 406db886eeed3156da986df58c4f10c0b332a3a9..24542fd5b802ff45b3b1e7e034271b7a579519db 100644 (file)
@@ -1570,9 +1570,10 @@ void CGDebugInfo::UpdateLineDirectiveRegion(CGBuilderTy &Builder) {
           && "error handling  #line regions!");
 
   bool SeenThisFile = false;
+  // Chek if current file is already seen earlier.
   for(std::vector<const char *>::iterator I = LineDirectiveFiles.begin(),
         E = LineDirectiveFiles.end(); I != E; ++I)
-    if (!strcmp(PPLoc.getFilename(), *I)) {
+    if (!strcmp(PCLoc.getFilename(), *I)) {
       SeenThisFile = true;
       break;
     }
diff --git a/test/CodeGen/debug-info-line.c b/test/CodeGen/debug-info-line.c
new file mode 100644 (file)
index 0000000..b255d90
--- /dev/null
@@ -0,0 +1,15 @@
+// RUN: %clang -emit-llvm -S -g %s -o %t
+// RUN: grep DW_TAG_lexical_block %t | count 3
+
+// Radar 8396182
+// There are three lexical blocks in this test case.
+
+int foo() {
+  int i = 1;
+# 4 "m.c"
+# 1 "m.h" 1
+  int j = 2;
+# 2 "m.h"
+# 5 "m.c" 2
+  return i + j;
+}