[PATCH] Add CXXMethodDecl::getInlineBody() and fix cpp11-migrate segfault

Guillaume Papin guillaume.papin at epitech.eu
Mon Apr 29 08:52:44 PDT 2013


Thank you! I will submit a new patch addressing the issues you have
pointed out.

Richard Smith <richard at metafoo.co.uk> writes:

> On Sun, Apr 28, 2013 at 2:58 PM, Guillaume Papin
> <guillaume.papin at epitech.eu> wrote:
>
>     I implemented it in cpp11-migrate at first but then thought it
>     would be
>     a better fit next to hasInlineBody(), so it would mimic
>     FunctionDecl::hasBody()/getBody(). It feels strange to me to have
>     hasInlineBody() without its getter counterpart. But no problem for
>     me to
>     put it back in cpp11-migrate.
>     
>     I tried to find a case where it's risky to insert the override but
>     I
>     couldn't find one (e.g: a specialization dropping 'virtual' is not
>     matched). Do you have one in mind?
>
> Something like this:
>
> template<typename T> struct Derived : T {
> void f(); // adding 'override' here will break instantiation of
> Derived<Base2>
> };
> struct Base1 {
> virtual void f();
> };
> struct Base2 {};
>
> Derived<Base1> d1;
> Derived<Base2> d2;
>
>     
>     Richard Smith <richard at metafoo.co.uk> writes:
>     
>     > I'm not convinced this is the right approach: getInlineBody has
>     weird
>     > semantics and thus it doesn't seem like a good fit as a general
>     > purpose AST interface. It would make a lot more sense to me to
>     have
>     > the fallback to the template in the cpp11-migrate code, where it
>     can
>     > also handle other consequences of this, such as classifying such
>     a fix
>     > as "risky" (because it might not be correct for every
>     instantiation).
>     >
>     > On Sun, Apr 28, 2013 at 7:21 AM, Guillaume Papin
>     > <guillaume.papin at epitech.eu> wrote:
>     >
>     > Uh, embarrassing, of course I failed the attachments:
>     >
>     >
>     >
>     > --
>     > Guillaume Papin
>     >
>     > _______________________________________________
>     > cfe-commits mailing list
>     > cfe-commits at cs.uiuc.edu
>     > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>     >
>     >
>     >
>     
>     
>     --
>     Guillaume Papin
>     
>
>

-- 
Guillaume Papin




More information about the cfe-commits mailing list