[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] default instance variable visibility
From:       Fariborz Jahanian <fjahanian () apple ! com>
Date:       2008-04-29 23:07:17
Message-ID: D9768779-B0C4-4E0E-9541-A7A0C54423BD () apple ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>


[Attachment #5 (text/html)]

<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><br><div><html>On Apr 29, 2008, at 3:13 PM, \
Chris Lattner wrote:</html><br class="Apple-interchange-newline"><blockquote \
type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><div><div>On Apr 29, 2008, at 12:48 PM, \
Fariborz Jahanian wrote:</div><blockquote type="cite"><div style="word-wrap: \
break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Yes, \
it should be protected by default. &nbsp;Thanks.</div></blockquote><div><br \
class="webkit-block-placeholder"></div>Fariborz, can you please apply the patch? \
&nbsp;Thanks,</div></div></blockquote><div><br></div>Done.</div><div><br></div><div>- \
Fariborz</div><div><br><blockquote type="cite"><div style="word-wrap: break-word; \
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br \
class="webkit-block-placeholder"></div><div>-Chris</div><div><br><blockquote \
type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><div><br></div><div>- \
Fariborz</div><div><br><div><br></div><div><br><div>On Apr 29, 2008, at 11:23 AM, \
Emerson Murphy-Hill wrote:<br class="Apple-interchange-newline"><blockquote \
type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; ">I noticed when clang parses objective-c \
interfaces, the default visibility for instance variables is private. &nbsp;For \
example, in this code<div><br></div><div><div style="margin-top: 0px; margin-right: \
0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal \
Monaco; color: rgb(170, 13, 145); ">@interface<span style="color: #000000"> Bloo \
{</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; &nbsp; \
<span style="color: #aa0d91">int</span> somevar;</div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal \
10px/normal Monaco; ">}</div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; \
"><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font \
class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" \
style="font-size: 12px;">somevar is reportedly private visibility, by&nbsp;<span \
class="Apple-style-span" style="color: rgb(46, 13, 110); font-family: Monaco; \
font-size: 10px; ">getAccessControl <font class="Apple-style-span" color="#000000" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: \
12px;">on</span></font>&nbsp;<span class="Apple-style-span" style="color: rgb(0, 0, \
0); ">ObjCIvarDecl<span class="Apple-style-span" style="font-family: Helvetica; \
font-size: 12px; ">. &nbsp;I believe that default visibility is supposed to be \
protected:</span></span></span></span></font></div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal \
10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><a \
href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ObjC.pdf">h \
ttp://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ObjC.pdf</a></span></font></div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: \
12px;"><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; \
"><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;">Here's a \
patch:</span></font></div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; \
"><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: \
12px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font \
class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" \
style="font-size: 12px;">Index: ParseObjc.cpp</span></font></div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: \
12px;">===================================================================</span></font></div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">--- \
ParseObjc.cpp</span></font><span class="Apple-tab-span" style="white-space:pre"><font \
class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" \
style="font-size: 12px;">	</span></font></span><font class="Apple-style-span" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: \
12px;">(revision 50182)</span></font></div><div style="margin-top: 0px; margin-right: \
0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal \
Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;">+++ \
ParseObjc.cpp</span></font><span class="Apple-tab-span" style="white-space:pre"><font \
class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" \
style="font-size: 12px;">	</span></font></span><font class="Apple-style-span" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: \
12px;">(working copy)</span></font></div><div style="margin-top: 0px; margin-right: \
0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal \
Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;">@@ -758,7 +758,7 \
@@</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: \
0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font \
class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" \
style="font-size: 12px;">&nbsp;</span></font></div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal \
10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; SourceLocation \
LBraceLoc = ConsumeBrace(); // the "{"</span></font></div><div style="margin-top: \
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal \
normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" \
size="3"><span class="Apple-style-span" style="font-size: \
12px;">&nbsp;&nbsp;&nbsp;</span></font></div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal \
10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;">- &nbsp;tok::ObjCKeywordKind \
visibility = tok::objc_private;</span></font></div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal \
10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;">+ &nbsp;tok::ObjCKeywordKind \
visibility = tok::objc_protected;</span></font></div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal \
10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span \
class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; // While we still have \
something to read, read the instance variables.</span></font></div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" \
face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: \
12px;">&nbsp;&nbsp; while (Tok.isNot(tok::r_brace) &amp;&amp; Tok.isNot(tok::eof)) \
{</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: \
0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font \
class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" \
style="font-size: 12px;">&nbsp;&nbsp; &nbsp; // Each iteration of this loop reads one \
objc-instance-variable-decl.</span></font></div><div><font class="Apple-style-span" \
face="Monaco" size="2"><span class="Apple-style-span" style="font-size: \
10px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" \
size="2"><span class="Apple-style-span" style="font-size: 10px;"><span \
class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; \
">Cheers,</span></span></font></div><div><br></div><div><font \
class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" \
style="font-size: 10px;"><span class="Apple-style-span" style="font-family: \
Helvetica; font-size: 12px; \
">e<br></span></span></font></div></span></font></div></div></div>_______________________________________________<br>cfe-dev \
mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br><a \
href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mail \
man/listinfo/cfe-dev</a><br></blockquote></div><br></div></div></div>_______________________________________________<br>cfe-dev \
mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br><a \
href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mail \
man/listinfo/cfe-dev</a><br></blockquote></div><br></div></blockquote></div><br></body></html>




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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic