]> granicus.if.org Git - clang/commitdiff
Fix a loop overrun in ComputePreamble when the last remapped file was erased,
authorDaniel Dunbar <daniel@zuster.org>
Thu, 19 Aug 2010 19:40:40 +0000 (19:40 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 19 Aug 2010 19:40:40 +0000 (19:40 +0000)
and reenable crash recovery test.
 - Reparsing is still very crashy / weird, so I had to sprinkle random code into
   the remapped input to get it to do what I want (i.e., crash!).

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

lib/Frontend/ASTUnit.cpp
test/Index/Inputs/crash-recovery-reparse-remap.c
test/Index/crash-recovery-reparse.c

index 523b8d0a6c2165f47459ff6c03548829d7874791..4395246f49324c213ed9222803cf00e11056d18a 100644 (file)
@@ -850,6 +850,8 @@ ASTUnit::ComputePreamble(CompilerInvocation &Invocation,
           // Remove this remapping. We've captured the buffer already.
           M = PreprocessorOpts.eraseRemappedFile(M);
           E = PreprocessorOpts.remapped_file_end();
+          if (M == E)
+            break;
         }
       }
     }
@@ -875,6 +877,8 @@ ASTUnit::ComputePreamble(CompilerInvocation &Invocation,
           // Remove this remapping. We've captured the buffer already.
           M = PreprocessorOpts.eraseRemappedFile(M);
           E = PreprocessorOpts.remapped_file_buffer_end();
+          if (M == E)
+            break;
         }
       }
     }
index 8a7707a59024314a15a4f5bb12b902fa1e32e771..0357dbe748a8baf1ab98728c14805fd86811c527 100644 (file)
@@ -1,3 +1,11 @@
+
 #warning parsing remapped file
 
+
+
+int x;
+
 #pragma clang __debug crash
+
+int x;
+
index 90ce25d1ad2bee1e3545e6d397c9b67bd3c191f3..0697576880f7a17137f4b2eb9de8af967513a551 100644 (file)
@@ -1,12 +1,8 @@
-// Disabled, pending investigation.
-// RUN: false
-// XFAIL: *
-//
-// RUNX: env CINDEXTEST_EDITING=1 \
-// RUNX:   not c-index-test -test-load-source-reparse 1 local \
-// RUNX:   -remap-file="%s;%S/Inputs/crash-recovery-reparse-remap.c" \
-// RUNX:   %s 2> %t.err
-// RUNX: FileCheck < %t.err -check-prefix=CHECK-REPARSE-SOURCE-CRASH %s
+// RUN: env CINDEXTEST_EDITING=1 \
+// RUN:   not c-index-test -test-load-source-reparse 1 local \
+// RUN:   -remap-file="%s;%S/Inputs/crash-recovery-reparse-remap.c" \
+// RUN:   %s 2> %t.err
+// RUN: FileCheck < %t.err -check-prefix=CHECK-REPARSE-SOURCE-CRASH %s
 // CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit
 //
 // XFAIL: win32