[cfe-commits] r59502 - in /cfe/trunk: Driver/ include/clang/Analysis/ include/clang/Analysis/PathSensitive/ include/clang/Basic/ include/clang/Driver/ lib/Analysis/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Lex/ lib/Parse/ lib/Sema/
clattner at apple.com
Tue Nov 18 11:56:42 PST 2008
On Nov 18, 2008, at 11:47 AM, Douglas Gregor wrote:
>>> so, then the operator<<'s for DiagnosticInfo could first check
>>> isSuppressed(), and abort early if the diagnostic is suppressed.
>>> way, we never pay for formatting strings (e.g., for a type name or
>>> expression) or copying them (see my comment below).
>> This commit was just one step along the way. Currently diags still
>> traffic in std::strings. I'd like to change DiagnosticInfo to use
>> an array of unions of "stuff", some of which may be strings, some
>> may be types, some may be integers etc. If the diagnostic is never
>> printed, the formatting would just never happen.
> I think that we can get much further if diags just have an array of
> std::strings (not pointers to strings), and the behavior of
> operator<< for types, expressions, declarations, etc. is just to
> create a string on-the-fly.
I don't think that will work. The conversion to strings would have to
happen independent of the DiagnosticClient (e.g. the CLI, GUI, HTML
outputer etc). We really want the DiagnosticClient to decide how to
render (e.g.) a type.
> It's not the final version---which would use the array of unions of
> "stuff"---but it'll get us further than what we have now. At the
> very least, it'll let us provide overloaded operator<<'s for
> QualType so we can start converting Diags away from explicitly
> calling QualType::getAsString().
Sure, I'm hoping to wrap up the implementation of this in the next
couple of days at the worst.
More information about the cfe-commits