On Apr 11, 2013, at 10:21 PM, Douglas Gregor <dgre...@apple.com> wrote:

> 
> On Apr 9, 2013, at 2:10 PM, jahanian <fjahan...@apple.com> wrote:
> 
>> 
>> On Apr 9, 2013, at 1:47 PM, Douglas Gregor <dgre...@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>.

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

- Fariborz

> 
>       - Doug

_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to