[cfe-commits] r114018 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/debug-info-line.c

Devang Patel dpatel at apple.com
Wed Sep 15 13:50:43 PDT 2010


Author: dpatel
Date: Wed Sep 15 15:50:40 2010
New Revision: 114018

URL: http://llvm.org/viewvc/llvm-project?rev=114018&view=rev
Log:
While handling change of file, check if _current_ file is already seen or not. If current file is seen then it indicates that end of previous file's lexical scope.
This fixes radar 8396182.

Added:
    cfe/trunk/test/CodeGen/debug-info-line.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=114018&r1=114017&r2=114018&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Sep 15 15:50:40 2010
@@ -1570,9 +1570,10 @@
           && "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;
     }

Added: cfe/trunk/test/CodeGen/debug-info-line.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-line.c?rev=114018&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-line.c (added)
+++ cfe/trunk/test/CodeGen/debug-info-line.c Wed Sep 15 15:50:40 2010
@@ -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;
+}





More information about the cfe-commits mailing list