[cfe-dev] default instance variable visibility
Fariborz Jahanian
fjahanian at apple.com
Tue Apr 29 12:48:22 PDT 2008
Yes, it should be protected by default. Thanks.
- 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080429/53167f63/attachment.html>
More information about the cfe-dev
mailing list