r177177 - ClangTool output cleanup

Edwin Vane edwin.vane at intel.com
Fri Mar 15 13:14:01 PDT 2013


Author: revane
Date: Fri Mar 15 15:14:01 2013
New Revision: 177177

URL: http://llvm.org/viewvc/llvm-project?rev=177177&view=rev
Log:
ClangTool output cleanup

Information messages sent to stdout by ClangTool now only happen when the
-debug flag is set.

Error messages that used to go to stdout now go to stderr.

Author: Ariel J Bernal <ariel.j.bernal at intel.com>

Modified:
    cfe/trunk/lib/Tooling/Tooling.cpp
    cfe/trunk/test/Tooling/pch.cpp

Modified: cfe/trunk/lib/Tooling/Tooling.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=177177&r1=177176&r2=177177&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Tooling.cpp (original)
+++ cfe/trunk/lib/Tooling/Tooling.cpp Fri Mar 15 15:14:01 2013
@@ -22,6 +22,7 @@
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/raw_ostream.h"
@@ -295,14 +296,19 @@ int ClangTool::run(FrontendActionFactory
       ArgsAdjuster->Adjust(CompileCommands[I].second.CommandLine);
     assert(!CommandLine.empty());
     CommandLine[0] = MainExecutable;
-    llvm::outs() << "Processing: " << File << ".\n";
+    // FIXME: We need a callback mechanism for the tool writer to output a
+    // customized message for each file.
+    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";
+      // FIXME: Diagnostics should be used instead.
+      llvm::errs() << "Error while processing " << File << ".\n";
       ProcessingFailed = true;
     }
   }

Modified: cfe/trunk/test/Tooling/pch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/pch.cpp?rev=177177&r1=177176&r2=177177&view=diff
==============================================================================
--- cfe/trunk/test/Tooling/pch.cpp (original)
+++ cfe/trunk/test/Tooling/pch.cpp Fri Mar 15 15:14:01 2013
@@ -6,12 +6,10 @@
 // RUN: %clang -x c++-header %S/Inputs/pch.h -o %t1
 
 // Use the generated pch and enforce a subsequent stat miss by using
-// the test file with an unrelated include as second translation unit:
-// Do not directly pipe into FileCheck, as that would hide errors from
-// valgrind due to pipefail not being set in lit.
-// RUN: clang-check "%S/Inputs/pch.cpp" "%s" -- -include-pch %t1 -I "%S" -c >%t2 2>&1
-// RUN: FileCheck %s < %t2
+// the test file with an unrelated include as second translation unit.
+// Test for an non-empty file after clang-check is executed.
+// RUN: clang-check -ast-dump "%S/Inputs/pch.cpp" "%s" -- -include-pch %t1 -I "%S" -c >%t2 2>&1
+// REQUIRES: shell
+// RUN: test -s %t2
 
 #include "Inputs/pch-fail.h"
-
-// CHECK: Processing





More information about the cfe-commits mailing list