[cfe-commits] r111983 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Frontend/PreprocessorOutputOptions.h lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp lib/Frontend/PrintPreprocessedOutput.cpp test/Frontend/Inputs/ t
Daniel Dunbar
daniel at zuster.org
Wed Sep 8 11:21:25 PDT 2010
On Sat, Sep 4, 2010 at 3:24 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Sep 4, 2010, at 1:57 PM, Daniel Dunbar wrote:
>
>>>>
>>>> + // Dump the header include information, if enabled and we are past the
>>>> + // predefines buffer.
>>>> + if (DumpHeaderIncludes && HasProcessedPredefines &&
>>>> + Reason == PPCallbacks::EnterFile) {
>>>> + llvm::SmallString<256> Msg;
>>>> + llvm::raw_svector_ostream OS(Msg);
>>>> + for (unsigned i = 0; i != CurrentIncludeDepth; ++i)
>>>> + OS << '.';
>>>> + OS << ' ' << CurFilename << '\n';
>>>> + llvm::errs() << OS.str();
>>>
>>> Why the temporary SmallString?
>>
>> It writes on llvm::errs() directly, which has horrible buffering
>> behavior. I didn't want to be flushing out one character at a time. A
>> generally solution to this problem would make more sense, but there
>> aren't so many places that output substantial text to stderr.
>
> Alrighty. If you wanted to simplify the code, you don't actually need raw_svector_ostream. Msg.push_back and Msg.append should suffice for the operations you're doing.
I know that, but I find raw_ostream more readable / consistent in general.
- Daniel
>
> -Chris
More information about the cfe-commits
mailing list