[cfe-commits] PATCH: ASTMatchers-based refactoring callbacks to make common cases of refactoring easy

Manuel Klimek klimek at google.com
Fri Jul 13 09:58:53 PDT 2012


On Fri, Jul 13, 2012 at 5:53 PM, Daniel Jasper <djasper at google.com> wrote:
> New patch attached:
> - More tests.
> - Fixed line length.
> - Better integer literal.

Are you sure you want StringRef as class members here?

+    } else {
+      // If we don't have the appropriate clause, then just delete
the whole if.
+      if (!PickTrueBranch)
+        Replace.insert(replaceStmtWithText(*Result.SourceManager, *Node, ""));
+    }

I'd make that
} else if (!PickTrueBranch) {
  // If we want to use the 'else'-branch, but it doesn't exist, delete
the whole 'if'.

+void run(const std::string &Code,

I'd call that expectRewritten or something similar.

Cheers,
/Manuel

>
>
> On Fri, Jul 13, 2012 at 5:07 PM, Daniel Jasper <djasper at google.com> wrote:
>>
>> :-D. Will change before submitting ...
>>
>>
>> On Fri, Jul 13, 2012 at 4:34 PM, Jean-Daniel Dupas
>> <devlists at shadowlab.org> wrote:
>>>
>>>
>>> +//
>>> +//  This will replace all integer literals with "2".
>>> +//
>>>
>>> Isn't the universal answer 42 instead of 2 ? ;-)
>>>
>>> Le 13 juil. 2012 à 16:22, Daniel Jasper <djasper at google.com> a écrit :
>>>
>>> > With these callbacks, simple refactorings should be quite easy. It is a
>>> > starting point and can be extended/improved in many ways.
>>> > <refactoring-callbacks.patch>_______________________________________________
>>> > cfe-commits mailing list
>>> > cfe-commits at cs.uiuc.edu
>>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>> -- Jean-Daniel
>>>
>>>
>>>
>>>
>>
>
>
> _______________________________________________
> 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