From: Chris Lattner Date: Mon, 20 Oct 2008 07:24:39 +0000 (+0000) Subject: move some code around to make it fall through more, no functionality change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ca329c00e72f301cbaaa42229b20a2f5bc793e5;p=clang 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 --- 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])