[cfe-commits] Patches for clang -ast-print

Dmitri Gribenko gribozavr at gmail.com
Sat Nov 17 15:01:16 PST 2012


On Sat, Nov 17, 2012 at 8:47 PM, Grzegorz Jablonski <grzejabl at gmail.com> wrote:
> On 11/10/2012 12:35 AM, Eli Friedman wrote:
>>
>> On Wed, Oct 31, 2012 at 9:27 AM, Jordan Rose <jordan_rose at apple.com>
>> wrote:
>>>
>>> [...]
>>>
>>> If you're okay with adding a PrintImplicitNodes bit to PrintingPolicy
>>> that
>>> would be good enough for us. Otherwise we'll have to think of something
>>> else.
>>
>> This seems okay to me.  Grzegorz?
>
> Patch attached.

         else
-          D->print(Out, /*Indentation=*/0, /*PrintInstantiation=*/true);
+        {
+          PrintingPolicy Policy(D->getASTContext().getPrintingPolicy());
+          Policy.PrintImplicitNodes=false;

Mechanical issues: '{' on the same line as 'else' and spaces around '='.

Non-mechanical issue: making -ast-dump differ from Decl->dump() might
not be a good idea.

+  /// \brief When true, do  print implicit nodes.
+  ///
+  bool PrintImplicitNodes : 1;

Empty line in comments is not needed.

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>*/



More information about the cfe-commits mailing list