From: Argyrios Kyrtzidis Date: Sun, 13 Nov 2011 23:39:14 +0000 (+0000) Subject: [libclang] Move the check for errors in c-index-test before the TU gets disposed. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16ac8be58801d45358497e90a2f82bc155da8a44;p=clang [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 --- 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;