Class Property: parse @dynamic (class).
rdar://23891898 llvm-svn: 259224
This commit is contained in:
parent
d91a12ec11
commit
0fe61f8688
|
@ -2353,6 +2353,31 @@ Decl *Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
|
|||
assert(Tok.isObjCAtKeyword(tok::objc_dynamic) &&
|
||||
"ParseObjCPropertyDynamic(): Expected '@dynamic'");
|
||||
ConsumeToken(); // consume dynamic
|
||||
|
||||
bool isClassProperty = false;
|
||||
if (Tok.is(tok::l_paren)) {
|
||||
ConsumeParen();
|
||||
const IdentifierInfo *II = Tok.getIdentifierInfo();
|
||||
|
||||
if (!II) {
|
||||
Diag(Tok, diag::err_objc_expected_property_attr) << II;
|
||||
SkipUntil(tok::r_paren, StopAtSemi);
|
||||
} else {
|
||||
SourceLocation AttrName = ConsumeToken(); // consume attribute name
|
||||
if (II->isStr("class")) {
|
||||
isClassProperty = true;
|
||||
if (Tok.isNot(tok::r_paren)) {
|
||||
Diag(Tok, diag::err_expected) << tok::r_paren;
|
||||
SkipUntil(tok::r_paren, StopAtSemi);
|
||||
} else
|
||||
ConsumeParen();
|
||||
} else {
|
||||
Diag(AttrName, diag::err_objc_expected_property_attr) << II;
|
||||
SkipUntil(tok::r_paren, StopAtSemi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (Tok.is(tok::code_completion)) {
|
||||
Actions.CodeCompleteObjCPropertyDefinition(getCurScope());
|
||||
|
@ -2371,6 +2396,7 @@ Decl *Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
|
|||
Actions.ActOnPropertyImplDecl(
|
||||
getCurScope(), atLoc, propertyLoc, false,
|
||||
propertyId, nullptr, SourceLocation(),
|
||||
isClassProperty ? ObjCPropertyQueryKind::OBJC_PR_query_class :
|
||||
ObjCPropertyQueryKind::OBJC_PR_query_unknown);
|
||||
|
||||
if (Tok.isNot(tok::comma))
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
@end
|
||||
|
||||
@implementation A
|
||||
@dynamic x;
|
||||
@dynamic x; // refers to the instance property
|
||||
@dynamic (class) x; // refers to the class property
|
||||
@synthesize z;
|
||||
@dynamic c;
|
||||
@dynamic c; // refers to the class property
|
||||
@end
|
||||
|
||||
int test() {
|
||||
|
|
Loading…
Reference in New Issue