[PATCH] Changed ClangTool processing file standard output to debug

Ariel Bernal ariel.j.bernal at intel.com
Wed Mar 6 09:46:49 PST 2013


Hi revane,

By default ClangTool::run writes the processing file name to standard output. 
Changed this to be a DEBUG output, enabled by -debug option.
Also changed the error while processing file message to standard error.


http://llvm-reviews.chandlerc.com/D499

Files:
  lib/Tooling/Tooling.cpp

Index: lib/Tooling/Tooling.cpp
===================================================================
--- lib/Tooling/Tooling.cpp
+++ lib/Tooling/Tooling.cpp
@@ -25,6 +25,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Debug.h"
 
 // For chdir, see the comment in ClangTool::run for more information.
 #ifdef _WIN32
@@ -295,14 +296,16 @@
       ArgsAdjuster->Adjust(CompileCommands[I].second.CommandLine);
     assert(!CommandLine.empty());
     CommandLine[0] = MainExecutable;
-    llvm::outs() << "Processing: " << File << ".\n";
+    DEBUG({
+      llvm::dbgs() << "Processing: " << File << ".\n";
+    });
     ToolInvocation Invocation(CommandLine, ActionFactory->create(), &Files);
     for (int I = 0, E = MappedFileContents.size(); I != E; ++I) {
       Invocation.mapVirtualFile(MappedFileContents[I].first,
                                 MappedFileContents[I].second);
     }
     if (!Invocation.run()) {
-      llvm::outs() << "Error while processing " << File << ".\n";
+      llvm::errs() << "Error while processing " << File << ".\n";
       ProcessingFailed = true;
     }
   }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D499.1.patch
Type: text/x-patch
Size: 1184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130306/c9d2237b/attachment.bin>


More information about the cfe-commits mailing list