diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-20 07:15:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-20 07:15:22 +0000 |
commit | cd9f4b31c4fe5b77b5519cc17b4583fab912bad1 (patch) | |
tree | fcaa3aa24fa89cd361220ecc18587a100666018b /lib/Parse/ParseObjc.cpp | |
parent | 91867641fde54191942c1cbb5d74f8defd0fd93d (diff) |
More property attribute recovery improvements. Instead of this:
crash.m:8:12: error: type name requires a specifier or qualifier
@property (readonlyx, getter=isAwesome) int _awesome;
^
crash.m:8:29: error: expected ';' at end of declaration list
@property (readonlyx, getter=isAwesome) int _awesome;
^
crash.m:8:39: error: expected identifier or '('
@property (readonlyx, getter=isAwesome) int _awesome;
^
we now get:
crash.m:8:12: error: unknown property attribute 'readonlyx'
@property (readonlyx, getter=isAwesome) int _awesome;
^
Also, we can eliminate isObjCPropertyAttribute now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 81eacf6544..c8544007c3 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -377,7 +377,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl, void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { SourceLocation LHSLoc = ConsumeParen(); // consume '(' - while (isObjCPropertyAttribute()) { + while (1) { const IdentifierInfo *II = Tok.getIdentifierInfo(); // getter/setter require extra treatment. if (II == ObjCPropertyAttrs[objc_getter] || @@ -393,7 +393,7 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { loc = ConsumeToken(); // consume method name if (Tok.isNot(tok::colon)) { Diag(loc, diag::err_expected_colon); - SkipUntil(tok::r_paren,true,true); + SkipUntil(tok::r_paren); return; } } else { @@ -402,13 +402,13 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { } } else { Diag(loc, diag::err_expected_ident); - SkipUntil(tok::r_paren,true,true); + SkipUntil(tok::r_paren); return; } } else { Diag(loc, diag::err_objc_expected_equal); - SkipUntil(tok::r_paren,true,true); + SkipUntil(tok::r_paren); return; } } else if (II == ObjCPropertyAttrs[objc_readonly]) @@ -423,6 +423,15 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_copy); else if (II == ObjCPropertyAttrs[objc_nonatomic]) DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nonatomic); + else if (II) { + Diag(Tok.getLocation(), diag::err_objc_expected_property_attr, + II->getName()); + SkipUntil(tok::r_paren); + return; + } else { + MatchRHSPunctuation(tok::r_paren, LHSLoc); + return; + } ConsumeToken(); // consume last attribute token if (Tok.is(tok::comma)) { @@ -550,18 +559,6 @@ IdentifierInfo *Parser::ParseObjCSelector(SourceLocation &SelectorLoc) { } } -/// property-attrlist: one of -/// readonly getter setter assign retain copy nonatomic -/// -bool Parser::isObjCPropertyAttribute() { - if (Tok.is(tok::identifier)) { - const IdentifierInfo *II = Tok.getIdentifierInfo(); - for (unsigned i = 0; i < objc_NumAttrs; ++i) - if (II == ObjCPropertyAttrs[i]) return true; - } - return false; -} - /// objc-for-collection-in: 'in' /// bool Parser::isTokIdentifier_in() const { |