[cfe-dev] Tooling output
Thompson, John
John_Thompson at playstation.sony.com
Thu Feb 21 18:15:59 PST 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130222/e9289f6a/attachment.html>
More information about the cfe-dev
mailing list