r179108 - Objective-C: This patch fixes a none-issuance of warning

Richard Smith richard at metafoo.co.uk
Fri Apr 12 18:26:46 PDT 2013

On Fri, Apr 12, 2013 at 10:26 AM, jahanian <fjahanian at apple.com> wrote:

> On Apr 11, 2013, at 10:21 PM, Douglas Gregor <dgregor at apple.com> wrote:
> On Apr 9, 2013, at 2:10 PM, jahanian <fjahanian at apple.com> wrote:
> On Apr 9, 2013, at 1:47 PM, Douglas Gregor <dgregor at apple.com> wrote:
> When we lookup the property in class’s protocol list, we hit forward
> declarations in the list. It is better to fix the list in one place rather
> than everywhere we need to look into
> the list. Does this cause a problem for modules? If so, I can move this to
> where property is looked up. But I think this is a better fix.
> I guess we've discussed this before. In general, I'd rather the AST
> reflect what was parsed, such that the result in the protocol list is
> precisely the declaration we saw. However, the Objective-C parts of Sema
> haven't been made robust against getting forward declarations, so just
> putting in the definition is livable until we find a better general
> solution.
> Correct,  For Objective-C, we have not been following this closely.
> Following is the similar case for forward classes.
> (note in the ast-dump that Sub's ’Super’ is the class definition and not
> the forward class).
> @interface Super @end
> @class Super;
> @interface Sub : Super
> @end
> /**
> |-ObjCInterfaceDecl 0x7fd630827a80 <c.m:1:1, col:19> Super
> |-ObjCInterfaceDecl 0x7fd630827b80 prev 0x7fd630827a80 <line:3:1, col:8>
> Super
> `-ObjCInterfaceDecl 0x7fd630858610 <line:5:1, line:6:2> Sub
>   |-super ObjCInterface 0x7fd630827a80 'Super'
> */
> I also see  the same thing in c++ (unless ast-dump is going to class
> definition which I did not check).
> Note that base class ’S’  for ’T’ has the source location for ’S’’s class
> definition  <col:1, col:8>.

No, the output is a bit confusing and you've misinterpreted it.

> struct S {};
> struct S;
> struct T : S {};
> /**
> |-CXXRecordDecl 0x7ff1b1829880 <s.cpp:1:1, col:11> struct S
> | `-CXXRecordDecl 0x7ff1b1829990 <col:1, col:8> struct S
> |-CXXRecordDecl 0x7ff1b1829a20 prev 0x7ff1b1829880 <line:2:1, col:8>
> struct S
> `-CXXRecordDecl 0x7ff1b1829ab0 <line:3:1, col:15> struct T
>   |-public 'struct S'
>   `-CXXRecordDecl 0x7ff1b1860610 <col:1, col:8> struct T

This is T's injected-class-name, not the 'S' base class. The source range
here is column 1 to column 8, of the most-recently-mentioned line (line 3).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130412/193f044b/attachment.html>

More information about the cfe-commits mailing list