[cfe-dev] default instance variable visibility

Fariborz Jahanian fjahanian at apple.com
Tue Apr 29 16:07:17 PDT 2008


On Apr 29, 2008, at 3:13 PM, Chris Lattner wrote:

> On Apr 29, 2008, at 12:48 PM, Fariborz Jahanian wrote:
>> Yes, it should be protected by default.  Thanks.
>
> Fariborz, can you please apply the patch?  Thanks,

Done.

- Fariborz

>
> -Chris
>
>>
>> - Fariborz
>>
>>
>>
>> On Apr 29, 2008, at 11:23 AM, Emerson Murphy-Hill wrote:
>>> I noticed when clang parses objective-c interfaces, the default  
>>> visibility for instance variables is private.  For example, in  
>>> this code
>>>
>>> @interface Bloo {
>>>     int somevar;
>>> }
>>>
>>> somevar is reportedly private visibility, by getAccessControl on  
>>> ObjCIvarDecl.  I believe that default visibility is supposed to be  
>>> protected:
>>>
>>> http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ObjC.pdf
>>>
>>> Here's a patch:
>>>
>>> Index: ParseObjc.cpp
>>> ===================================================================
>>> --- ParseObjc.cpp	(revision 50182)
>>> +++ ParseObjc.cpp	(working copy)
>>> @@ -758,7 +758,7 @@
>>>
>>>    SourceLocation LBraceLoc = ConsumeBrace(); // the "{"
>>>
>>> -  tok::ObjCKeywordKind visibility = tok::objc_private;
>>> +  tok::ObjCKeywordKind visibility = tok::objc_protected;
>>>    // While we still have something to read, read the instance  
>>> variables.
>>>    while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
>>>      // Each iteration of this loop reads one objc-instance- 
>>> variable-decl.
>>>
>>> Cheers,
>>>
>>> e
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080429/b16c1b02/attachment.html>


More information about the cfe-dev mailing list