diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-20 07:24:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-20 07:24:39 +0000 |
commit | 8ca329c00e72f301cbaaa42229b20a2f5bc793e5 (patch) | |
tree | 5fcb9a7ee325ac611c6e02169a318c40c7d0b53f /lib/Parse/ParseObjc.cpp | |
parent | f6ed85533583dae18a44ddc4be6cfc4d68749e36 (diff) |
move some code around to make it fall through more, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57813 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index eee3cac479..652a6a4be7 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -304,9 +304,8 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl, ObjCDeclSpec OCDS; // Parse property attribute list, if any. - if (Tok.is(tok::l_paren)) { + if (Tok.is(tok::l_paren)) ParseObjCPropertyAttribute(OCDS); - } // Parse all the comma separated declarators. DeclSpec DS; @@ -379,6 +378,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl, /// nonatomic /// void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { + assert(Tok.getKind() == tok::l_paren); SourceLocation LHSLoc = ConsumeParen(); // consume '(' while (1) { @@ -395,33 +395,32 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) { II == ObjCPropertyAttrs[objc_setter]) { // skip getter/setter part. SourceLocation loc = ConsumeToken(); - if (Tok.is(tok::equal)) { - loc = ConsumeToken(); - if (Tok.is(tok::identifier)) { - if (II == ObjCPropertyAttrs[objc_setter]) { - DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_setter); - DS.setSetterName(Tok.getIdentifierInfo()); - loc = ConsumeToken(); // consume method name - if (Tok.isNot(tok::colon)) { - Diag(loc, diag::err_expected_colon); - SkipUntil(tok::r_paren); - return; - } - } else { - DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_getter); - DS.setGetterName(Tok.getIdentifierInfo()); - } - } else { - Diag(loc, diag::err_expected_ident); - SkipUntil(tok::r_paren); - return; - } - } - else { + if (Tok.isNot(tok::equal)) { Diag(loc, diag::err_objc_expected_equal); SkipUntil(tok::r_paren); return; } + + loc = ConsumeToken(); + if (Tok.isNot(tok::identifier)) { + Diag(loc, diag::err_expected_ident); + SkipUntil(tok::r_paren); + return; + } + + if (II == ObjCPropertyAttrs[objc_setter]) { + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_setter); + DS.setSetterName(Tok.getIdentifierInfo()); + loc = ConsumeToken(); // consume method name + if (Tok.isNot(tok::colon)) { + Diag(loc, diag::err_expected_colon); + SkipUntil(tok::r_paren); + return; + } + } else { + DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_getter); + DS.setGetterName(Tok.getIdentifierInfo()); + } } else if (II == ObjCPropertyAttrs[objc_readonly]) DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readonly); else if (II == ObjCPropertyAttrs[objc_assign]) |