[PATCH] Change ClangTool::run output processing file to debug output

Ariel Bernal ariel.j.bernal at intel.com
Fri Mar 15 12:45:48 PDT 2013


  - clan-check now dumps the ast and then we test for a non-empty output file
  - added some FIXME comments

Hi revane,

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

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D543?vs=1296&id=1300#toc

Files:
  lib/Tooling/Tooling.cpp
  test/Tooling/pch.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,19 @@
       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;
     }
   }
Index: test/Tooling/pch.cpp
===================================================================
--- test/Tooling/pch.cpp
+++ test/Tooling/pch.cpp
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D543.3.patch
Type: text/x-patch
Size: 2282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130315/06dadb3a/attachment.bin>


More information about the cfe-commits mailing list