[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

dawn at burble.org dawn at burble.org
Tue Sep 7 18:03:51 PDT 2010


I would like to see a more general solution that all of clang can
beneefit from.  Are we planning to live with llvm::errs()'s "horrible
buffering behavior" forever?  If not, it would be good to encapsulate
work-arounds like this SmallString use so that all parts of the compiler
will benefit, and it will be easy to undo later.  At a minimum, I would like
to see a comment explaining why the SmallString buffer was used here.

Thanks!
-Dawn

On Sat, Sep 04, 2010 at 01:57:46PM -0700, Daniel Dunbar wrote:
> On Fri, Sep 3, 2010 at 9:49 AM, Chris Lattner <clattner at apple.com> wrote:
> >
> > On Aug 24, 2010, at 3:44 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.
> 
>  - Daniel
> 
> > -Chris
> >
> >
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list