[cfe-commits] r67265 - in /cfe/trunk: include/clang/AST/ include/clang/Parse/ lib/AST/ lib/CodeGen/ lib/Parse/ lib/Sema/ test/SemaCXX/ test/SemaTemplate/

Douglas Gregor dgregor at apple.com
Wed Mar 18 17:46:32 PDT 2009


On Mar 18, 2009, at 5:26 PM, Mike Stump wrote:

> On Mar 18, 2009, at 5:18 PM, Douglas Gregor wrote:
>> Introduce a representation for types that we referred to via a  
>> qualified name
>
> I'll give you a cookie if you add a pretty printer for all of this  
> (aka -ast-print).  :-)


It's already done. QualifiedNameTypes have support for  
getAsStringInternal, which is used to print types in the AST as well  
as for diagnostics. So, given:

   foo::wibble::x a;
   ::bar::y b;
   a + b;

we'll get an error message like:

error: invalid operands to binary expression ('foo::wibble::x' (aka  
'struct x') and '::bar::y' (aka 'int'))
   a + b;
   ~ ^ ~

And if you go ahead and pretty-print , a and b will come out as:

   foo::wibble::x a;
   ::bar::y b;

Cookie collected and enjoyed ;)

	- Doug



More information about the cfe-commits mailing list