summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2016-03-01 10:56:19 +0000
committerManuel Klimek <klimek@google.com>2016-03-01 10:56:19 +0000
commit016c024ca4798796480af7ecae6758e95600550f (patch)
treee599961bf87585bea4ae6ded81756f747efc4a40 /clang/tools/libclang/CIndex.cpp
parent255689c3ad4feb4af32aea0a50ab881f472a66e9 (diff)
downloadbcm5719-llvm-016c024ca4798796480af7ecae6758e95600550f.tar.gz
bcm5719-llvm-016c024ca4798796480af7ecae6758e95600550f.zip
Optionally demote fatal errors to non-fatal errors.
This behavior is enabled when the new CXTranslationUnit_KeepGoing option is passed to clang_parseTranslationUnit{,2}. It is geared towards use by IDEs and similar consumers of the clang-c API where fatal errors may arise when parsing incomplete code mid-edit, or when include paths are not properly configured yet. In such situations one still wants to get as much information as possible about a TU. Previously, the semantic analysis would not instantiate templates or report additional fatal errors after the first fatal error was encountered. Fixes PR24268. Patch by Milian Wolff. llvm-svn: 262318
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 6ea379a8cd1..b3f33ad8ffd 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -3158,6 +3158,9 @@ clang_parseTranslationUnit_Impl(CXIndex CIdx, const char *source_filename,
IntrusiveRefCntPtr<DiagnosticsEngine>
Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions));
+ if (options & CXTranslationUnit_KeepGoing)
+ Diags->setFatalsAsError(true);
+
// Recover resources if we crash before exiting this function.
llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
OpenPOWER on IntegriCloud