"instance variable is already declared">;
def warn_on_superclass_use : Warning<
"class implementation may not have super class">;
-def err_non_private_ivar_declaration : Error<
- "only private ivars may be declared in implementation">;
def err_conflicting_ivar_bitwidth : Error<
"instance variable %0 has conflicting bit-field width">;
def err_conflicting_ivar_name : Error<
if (Tok.is(tok::l_brace)) // we have ivars
ParseObjCClassInstanceVariables(ImplClsType/*FIXME*/,
- tok::objc_protected, atLoc);
+ tok::objc_private, atLoc);
ObjCImpDecl = ImplClsType;
PendingObjCImpDecl.push_back(ObjCImpDecl);
Diag(ClsIvar->getLocation(), diag::note_previous_definition);
continue;
}
- if (ImplIvar->getAccessControl() != ObjCIvarDecl::Private)
- Diag(ImplIvar->getLocation(), diag::err_non_private_ivar_declaration);
// Instance ivar to Implementation's DeclContext.
ImplIvar->setLexicalDeclContext(ImpDecl);
IDecl->makeDeclVisibleInContext(ImplIvar, false);
@implementation INTFSTANDALONE : Super // expected-warning {{class implementation may not have super class}}
{
-@private
- id IVAR1;
+ id PRIV_IVAR;
@protected
- id IVAR2; // expected-error {{only private ivars may be declared in implementation}}
+ id PRTCTD;
@private
id IVAR3;
int IVAR; // expected-error {{instance variable is already declared}}
+@public
+ id IVAR4;
}
@end
+
+@interface Base @end
+
+@implementation Base {
+ int ivar1;
+@public
+ int ivar2;
+}
+@end
+
+id fn1(INTFSTANDALONE *b) { return b->PRIV_IVAR; } // expected-error {{instance variable 'PRIV_IVAR' is private}}
+
+id fn2(INTFSTANDALONE *b) { return b->PRTCTD; } // expected-error {{instance variable 'PRTCTD' is protected}}
+
+id fn4(INTFSTANDALONE *b) { return b->IVAR4; }
+