[libclang] Move the check for errors in c-index-test before the TU gets disposed.

llvm-svn: 144514
This commit is contained in:
Argyrios Kyrtzidis 2011-11-13 23:39:14 +00:00
parent c4a2cb34bb
commit 70480496c8
1 changed files with 5 additions and 3 deletions

View 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;