aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-29 21:51:44 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-29 21:51:44 +0000
commitc58b75628c3860775fc3914aa6d08e84de82233f (patch)
tree73349120ba5df67f904689259bc80af2adaa9859 /tools
parent16e0f19415a37edf2aef8a3d99fd1b18be7762d9 (diff)
downloadclang-c58b75628c3860775fc3914aa6d08e84de82233f.tar.gz
[libclang] If libclang logging is enabled, print all compiler diagnostics to stderr instead of capturing them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178373 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/libclang/Indexing.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp
index 2bbf91f65b..2a504db2a4 100644
--- a/tools/libclang/Indexing.cpp
+++ b/tools/libclang/Indexing.cpp
@@ -539,7 +539,11 @@ static void clang_indexSourceFile_Impl(void *UserData) {
if (CXXIdx->isOptEnabled(CXGlobalOpt_ThreadBackgroundPriorityForIndexing))
setThreadBackgroundPriority();
- CaptureDiagnosticConsumer *CaptureDiag = new CaptureDiagnosticConsumer();
+ bool CaptureDiagnostics = !Logger::isLoggingEnabled();
+
+ CaptureDiagnosticConsumer *CaptureDiag = 0;
+ if (CaptureDiagnostics)
+ CaptureDiag = new CaptureDiagnosticConsumer();
// Configure the diagnostics.
IntrusiveRefCntPtr<DiagnosticsEngine>
@@ -609,7 +613,7 @@ static void clang_indexSourceFile_Impl(void *UserData) {
CInvok->getDiagnosticOpts().IgnoreWarnings = true;
ASTUnit *Unit = ASTUnit::create(CInvok.getPtr(), Diags,
- /*CaptureDiagnostics=*/true,
+ CaptureDiagnostics,
/*UserFilesAreVolatile=*/true);
OwningPtr<CXTUOwner> CXTU(new CXTUOwner(MakeCXTranslationUnit(CXXIdx, Unit)));
@@ -662,7 +666,7 @@ static void clang_indexSourceFile_Impl(void *UserData) {
Persistent,
CXXIdx->getClangResourcesPath(),
OnlyLocalDecls,
- /*CaptureDiagnostics=*/true,
+ CaptureDiagnostics,
PrecompilePreamble,
CacheCodeCompletionResults,
/*IncludeBriefCommentsInCodeCompletion=*/false,