[cfe-commits] r57817 - in /cfe/trunk: include/clang/Parse/Parser.h lib/Parse/ParseObjc.cpp lib/Parse/Parser.cpp

Chris Lattner sabre at nondot.org
Mon Oct 20 00:43:01 PDT 2008


Author: lattner
Date: Mon Oct 20 02:43:01 2008
New Revision: 57817

URL: http://llvm.org/viewvc/llvm-project?rev=57817&view=rev
Log:
eliminate ObjCPropertyAttrs an corresponding enums, just use
strcmp when needed.

Modified:
    cfe/trunk/include/clang/Parse/Parser.h
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/lib/Parse/Parser.cpp

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=57817&r1=57816&r2=57817&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Mon Oct 20 02:43:01 2008
@@ -390,12 +390,6 @@
     objc_NumQuals
   };
   IdentifierInfo *ObjCTypeQuals[objc_NumQuals];
-  // Definitions for ObjC2's @property attributes.
-  enum ObjCPropertyAttr {
-    objc_readonly=0, objc_getter, objc_setter, objc_assign, 
-    objc_readwrite, objc_retain, objc_copy, objc_nonatomic, objc_NumAttrs
-  };
-  IdentifierInfo *ObjCPropertyAttrs[objc_NumAttrs];
   
   bool isTokIdentifier_in() const;
 

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=57817&r1=57816&r2=57817&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Mon Oct 20 02:43:01 2008
@@ -392,20 +392,20 @@
     
     SourceLocation AttrName = ConsumeToken(); // consume last attribute name
     
-    if (II == ObjCPropertyAttrs[objc_readonly])
+    if (!strcmp(II->getName(), "readonly"))
       DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readonly);
-    else if (II == ObjCPropertyAttrs[objc_assign])
+    else if (!strcmp(II->getName(), "assign"))
       DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_assign);
-    else if (II == ObjCPropertyAttrs[objc_readwrite])
+    else if (!strcmp(II->getName(), "readwrite"))
       DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_readwrite);
-    else if (II == ObjCPropertyAttrs[objc_retain])
+    else if (!strcmp(II->getName(), "retain"))
       DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_retain);
-    else if (II == ObjCPropertyAttrs[objc_copy])
+    else if (!strcmp(II->getName(), "copy"))
       DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_copy);
-    else if (II == ObjCPropertyAttrs[objc_nonatomic])
+    else if (!strcmp(II->getName(), "nonatomic"))
       DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_nonatomic);
-    else if (II == ObjCPropertyAttrs[objc_getter] || 
-             II == ObjCPropertyAttrs[objc_setter]) {
+    else if (!strcmp(II->getName(), "getter") || 
+             !strcmp(II->getName(), "setter")) {
       // getter/setter require extra treatment.
       if (ExpectAndConsume(tok::equal, diag::err_objc_expected_equal, "",
                            tok::r_paren))
@@ -417,7 +417,7 @@
         return;
       }
       
-      if (II == ObjCPropertyAttrs[objc_setter]) {
+      if (II->getName()[0] == 's') {
         DS.setPropertyAttributes(ObjCDeclSpec::DQ_PR_setter);
         DS.setSetterName(Tok.getIdentifierInfo());
         ConsumeToken();  // consume method name

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=57817&r1=57816&r2=57817&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Mon Oct 20 02:43:01 2008
@@ -273,18 +273,6 @@
     ObjCTypeQuals[objc_bycopy] = &PP.getIdentifierTable().get("bycopy");
     ObjCTypeQuals[objc_byref] = &PP.getIdentifierTable().get("byref");
   }
-  if (getLang().ObjC2) {
-    ObjCPropertyAttrs[objc_readonly] = &PP.getIdentifierTable().get("readonly");
-    ObjCPropertyAttrs[objc_getter] = &PP.getIdentifierTable().get("getter");
-    ObjCPropertyAttrs[objc_setter] = &PP.getIdentifierTable().get("setter");
-    ObjCPropertyAttrs[objc_assign] = &PP.getIdentifierTable().get("assign");
-    ObjCPropertyAttrs[objc_readwrite] =
-                                  &PP.getIdentifierTable().get("readwrite");
-    ObjCPropertyAttrs[objc_retain] = &PP.getIdentifierTable().get("retain");
-    ObjCPropertyAttrs[objc_copy] = &PP.getIdentifierTable().get("copy");
-    ObjCPropertyAttrs[objc_nonatomic] =
-                                  &PP.getIdentifierTable().get("nonatomic");
-  }
 
   Ident_super = &PP.getIdentifierTable().get("super");
 }





More information about the cfe-commits mailing list