aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-13 23:39:14 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-13 23:39:14 +0000
commit16ac8be58801d45358497e90a2f82bc155da8a44 (patch)
tree69af841d72555ac351b1f7d582cc2241de180f78 /tools/c-index-test/c-index-test.c
parent590ad93bf59f4e5f6adcba0d78efc3a58cac15ce (diff)
[libclang] Move the check for errors in c-index-test before the TU gets disposed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r--tools/c-index-test/c-index-test.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 8ab7f9410d..ae970fb952 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -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;