]> granicus.if.org Git - clang/commitdiff
[libclang] Move the check for errors in c-index-test before the TU gets disposed.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 13 Nov 2011 23:39:14 +0000 (23:39 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 13 Nov 2011 23:39:14 +0000 (23:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144514 91177308-0d34-0410-b5e6-96231b3b80d8

tools/c-index-test/c-index-test.c

index 8ab7f9410d9092c6700f5c6a7099445ace4b1532..ae970fb9523e7854c69f67c46527634e66627bed 100644 (file)
@@ -709,6 +709,11 @@ static int perform_test_load(CXIndex Idx, CXTranslationUnit TU,
     PV(TU);
 
   PrintDiagnostics(TU);
+  if (checkForErrors(TU) != 0) {
+    clang_disposeTranslationUnit(TU);
+    return -1;
+  }
+
   clang_disposeTranslationUnit(TU);
   return 0;
 }
@@ -830,9 +835,6 @@ int perform_test_reparse_source(int argc, const char **argv, int trials,
   
   result = perform_test_load(Idx, TU, filter, NULL, Visitor, PV);
 
-  if (checkForErrors(TU) != 0)
-    return -1;
-
   free_remapped_files(unsaved_files, num_unsaved_files);
   clang_disposeIndex(Idx);
   return result;