]> granicus.if.org Git - clang/commitdiff
move some code around to make it fall through more, no functionality change.
authorChris Lattner <sabre@nondot.org>
Mon, 20 Oct 2008 07:24:39 +0000 (07:24 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 20 Oct 2008 07:24:39 +0000 (07:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57813 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp

index eee3cac479f22cb245eb578f5db403d28c3193eb..652a6a4be7c9744ba99f0cb37a8adadc69ffdea3 100644 (file)
@@ -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])