[cfe-dev] Tooling output

Thompson, John John_Thompson at playstation.sony.com
Mon Feb 25 16:58:49 PST 2013

Manuel and Sean,

Thanks for looking into it.

Turns out I'm not seeing the same behavior as before, where some errors were in different places with respect to the "Processing..." messages.

Curiously, after the last "Processing..." message, when the stuff in  modularize at the end is checked, the order of the errors can vary from run to run, so I guess there must be some multithreading going on or something, to make it non-deterministic.  But it doesn't seem to be an issue.  Sorry to trouble you.


From: Manuel Klimek [mailto:klimek at google.com]
Sent: Monday, February 25, 2013 12:48 AM
To: Thompson, John
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] Tooling output

I'm not sure that's the right change. To me, the output in question is not error / diagnostic output, and thus shouldn't go to stderr.

Two ways to fix this I see:
1. fix flushing behavior in Windows to match what's happening on linux
2. introduce a flag that switches off all output from the tooling apart from diagnostics (that might be useful anyway)


On Thu, Feb 21, 2013 at 6:15 PM, Thompson, John <John_Thompson at playstation.sony.com<mailto:John_Thompson at playstation.sony.com>> wrote:
On Windows, at least, when I run a tool such as modularize and redirect the outputs to a file, such as:

modularize testIncludes.txt -x c++ >modularizeout.txt 2>&1

the stderr and stdout outputs don't mix up correctly, presumably because the streams flush at different times.

Locally, I made the following change to work around this, sending a couple key messages to stderr instead:

Index: lib/Tooling/Tooling.cpp
--- lib/Tooling/Tooling.cpp     (revision 175711)
+++ lib/Tooling/Tooling.cpp     (working copy)
@@ -295,14 +295,14 @@
     CommandLine[0] = MainExecutable;
-    llvm::outs() << "Processing: " << File << ".\n";
+    llvm::errs() << "Processing: " << File << ".\n";
     ToolInvocation Invocation(CommandLine, ActionFactory->create(), &Files);
     for (int I = 0, E = MappedFileContents.size(); I != E; ++I) {
     if (!Invocation.run()) {
-      llvm::outs() << "Error while processing " << File << ".\n";
+      llvm::errs() << "Error while processing " << File << ".\n";
       ProcessingFailed = true;

Would this have a negative effect if I checked it in as-is, or should I add an option to the class to switch the output, or something else, or just leave it alone?



cfe-dev mailing list
cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130226/8c1dd70b/attachment.html>

More information about the cfe-dev mailing list