Tooling output

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

Is this `modularize` tool the one that Doug Gregor posted?

Also, adding Manuel to review the Tooling change.

-- Sean Silva

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

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.

-John