From: Argyrios Kyrtzidis Date: Fri, 29 Mar 2013 21:51:44 +0000 (+0000) Subject: [libclang] If libclang logging is enabled, print all compiler diagnostics to stderr... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c58b75628c3860775fc3914aa6d08e84de82233f;p=clang [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 --- 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 @@ -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 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,