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

Jordan Rose jordan_rose at apple.com
Mon Nov 26 15:09:23 PST 2012


On Nov 26, 2012, at 14:11 , Eli Friedman <eli.friedman at gmail.com> wrote:

> On Sat, Nov 17, 2012 at 10:47 AM, 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.
> 
> Sorry about the delayed review.
> 
> It doesn't look like your patch sets the PrintImplicitNodes bit
> correctly in all the cases we care about; for example, the following
> testcase:
> 
> struct MyClass10
> {
>    operator const char *() { return "str"; }
> };
> 
> void test10(const char *str)
> {
>    MyClass10* m;
>    extern int x;
>    extern decltype(test10(*m)) x;
> }
> 
> currently gives:
> 
> <stdin>:10:33: error: redefinition of 'x' with a different type:
> 'decltype(test10(*m.operator const char *()))' (aka 'void') vs 'int'
>    extern decltype(test10(*m)) x;
>                                ^
> <stdin>:9:16: note: previous definition is here
>    extern int x;
>               ^

I wonder if PrintImplicitNodes should default to 'false'; dumpers can take the extra time to set it to 'true', but the default behavior will be more user-friendly that way. 

It's a conservative change, though; does that mean we're getting it wrong currently?

Jordan



More information about the cfe-commits mailing list