summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/Indexing.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-04-11 02:11:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-04-11 02:11:16 +0000
commitac1cc934b36920ad14e5a724b0d00a36e7b72d55 (patch)
treead8831ec1150e61e2d9e519f0192fd4e659ca873 /clang/tools/libclang/Indexing.cpp
parent67a09fc397b9185c082c381e8885fd81a7bac838 (diff)
downloadbcm5719-llvm-ac1cc934b36920ad14e5a724b0d00a36e7b72d55.tar.gz
bcm5719-llvm-ac1cc934b36920ad14e5a724b0d00a36e7b72d55.zip
[libclang] If displayDiagnostics is set (when calling clang_createIndex), make sure to
output the errors that occurred even if we did not get an AST (e.g. because the PCH failed to load). Also honor displayDiagnostics in clang_indexSourceFile(). rdar://11203489 llvm-svn: 154472
Diffstat (limited to 'clang/tools/libclang/Indexing.cpp')
-rw-r--r--clang/tools/libclang/Indexing.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp
index 6ece54857a6..e660c4d6eb4 100644
--- a/clang/tools/libclang/Indexing.cpp
+++ b/clang/tools/libclang/Indexing.cpp
@@ -388,7 +388,8 @@ static void clang_indexSourceFile_Impl(void *UserData) {
}
}
- Unit = ASTUnit::LoadFromCompilerInvocationAction(CInvok.getPtr(), Diags,
+ DiagnosticErrorTrap DiagTrap(*Diags);
+ bool Success = ASTUnit::LoadFromCompilerInvocationAction(CInvok.getPtr(), Diags,
IndexAction.get(),
Unit,
Persistent,
@@ -397,7 +398,10 @@ static void clang_indexSourceFile_Impl(void *UserData) {
/*CaptureDiagnostics=*/true,
PrecompilePreamble,
CacheCodeCompletionResults);
- if (!Unit)
+ if (DiagTrap.hasErrorOccurred() && CXXIdx->getDisplayDiagnostics())
+ printDiagsToStderr(Unit);
+
+ if (!Success)
return;
if (out_TU)
OpenPOWER on IntegriCloud