]> granicus.if.org Git - clang/commitdiff
eliminate ObjCPropertyAttrs an corresponding enums, just use
authorChris Lattner <sabre@nondot.org>
Mon, 20 Oct 2008 07:43:01 +0000 (07:43 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 20 Oct 2008 07:43:01 +0000 (07:43 +0000)
strcmp when needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57817 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Parser.h
lib/Parse/ParseObjc.cpp
lib/Parse/Parser.cpp

index c47366f431d87b6ff6adde1bef68cda0dd8dfb5c..55b48ae99e82270e401cb83a167315cb060b49f7 100644 (file)
@@ -390,12 +390,6 @@ private:
     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;
 
index fa6b1a3fee058431778b43706d697650596543ea..10ac42718e481d1b43d0c13f780fcf3c9c651e29 100644 (file)
@@ -392,20 +392,20 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
     
     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 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
         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
index 697d0f6f53b79423d8520c3d80e4ee24e337df59..6beaac0151f6bc6c5043db772d8de8c2f6d3faa0 100644 (file)
@@ -273,18 +273,6 @@ void Parser::Initialize() {
     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");
 }