[cfe-dev] Tooling output

Manuel Klimek klimek at google.com
Mon Feb 25 00:47:32 PST 2013


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)

Cheers,
/Manuel


On Thu, Feb 21, 2013 at 6:15 PM, Thompson, John <
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 @@****
>
>        ArgsAdjuster->Adjust(CompileCommands[I].second.CommandLine);****
>
>      assert(!CommandLine.empty());****
>
>      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) {****
>
>        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;****
>
>      }****
>
>    }****
>
> ** **
>
> 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?****
>
> ** **
>
> Thanks.****
>
> ** **
>
> -John****
>
> ** **
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130225/7bcea3c7/attachment.html>


More information about the cfe-dev mailing list