[cfe-commits] r170606 - in /cfe/trunk: include/clang/AST/PrettyPrinter.h lib/AST/DeclPrinter.cpp tools/libclang/CXComment.cpp unittests/AST/DeclPrinterTest.cpp

jahanian fjahanian at apple.com
Wed Dec 19 15:54:21 PST 2012


On Dec 19, 2012, at 3:41 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

>> 
>> 
>>     Out << "}\n";
>> 
>>   }
>> -  Out << ' ' << PDecl->getType().getAsString(Policy) << ' ' << *PDecl << ';';
>> +  Out << ' ' << PDecl->getType().getAsString(Policy) << ' ' << *PDecl;
>> +  if (Policy.PolishForDeclaration)
>> +    Out << ';';
>> }
> 
> I don't really understand the motivation behind this condition.

This is because, when -ast-print  ';' is added as part of going over the entire DeclContext and 
printing each of its containing declarations (see VisitDeclContext). While from
the declaration tag, we are printing individual declarations. I noticed that
we were adding two ';' with ast-print after my recent change.
- Fariborz

> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121219/176f32dd/attachment.html>


More information about the cfe-commits mailing list