r178373 - [libclang] If libclang logging is enabled, print all compiler diagnostics to stderr instead of capturing them.

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Mar 29 14:51:45 PDT 2013


Author: akirtzidis
Date: Fri Mar 29 16:51:44 2013
New Revision: 178373

URL: http://llvm.org/viewvc/llvm-project?rev=178373&view=rev
Log:
[libclang] If libclang logging is enabled, print all compiler diagnostics to stderr instead of capturing them.

Modified:
    cfe/trunk/tools/libclang/Indexing.cpp

Modified: cfe/trunk/tools/libclang/Indexing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/Indexing.cpp?rev=178373&r1=178372&r2=178373&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/Indexing.cpp (original)
+++ cfe/trunk/tools/libclang/Indexing.cpp Fri Mar 29 16:51:44 2013
@@ -539,7 +539,11 @@ static void clang_indexSourceFile_Impl(v
   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(v
     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(v
                                                        Persistent,
                                                 CXXIdx->getClangResourcesPath(),
                                                        OnlyLocalDecls,
-                                                    /*CaptureDiagnostics=*/true,
+                                                       CaptureDiagnostics,
                                                        PrecompilePreamble,
                                                     CacheCodeCompletionResults,
                                  /*IncludeBriefCommentsInCodeCompletion=*/false,





More information about the cfe-commits mailing list