[cfe-commits] r57813 - /cfe/trunk/lib/Parse/ParseObjc.cpp
Chris Lattner
sabre at nondot.org
Mon Oct 20 00:24:39 PDT 2008
Author: lattner
Date: Mon Oct 20 02:24:39 2008
New Revision: 57813
URL: http://llvm.org/viewvc/llvm-project?rev=57813&view=rev
Log:
move some code around to make it fall through more, no functionality change.
Modified:
cfe/trunk/lib/Parse/ParseObjc.cpp
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=57813&r1=57812&r2=57813&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Mon Oct 20 02:24:39 2008
@@ -304,9 +304,8 @@
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 @@
/// nonatomic
///
void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
+ assert(Tok.getKind() == tok::l_paren);
SourceLocation LHSLoc = ConsumeParen(); // consume '('
while (1) {
@@ -395,33 +395,32 @@
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])
More information about the cfe-commits
mailing list