summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/tools/libclang/CIndex.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 63acd0abd59..a74feabf06f 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -2826,8 +2826,12 @@ clang_parseTranslationUnit(CXIndex CIdx,
CIdx, source_filename, command_line_args, num_command_line_args,
unsaved_files, num_unsaved_files, options, &TU);
(void)Result;
- assert((TU && Result == CXError_Success) ||
- (!TU && Result != CXError_Success));
+
+ // FIXME: This probably papers over a problem. If the result is not success,
+ // no TU should be set.
+ if (Result != CXError_Success)
+ return 0;
+
return TU;
}
OpenPOWER on IntegriCloud