From 5fd80fada1eeecd279af8333a7f58b86d8df8016 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 20 Oct 2008 07:43:01 +0000 Subject: [PATCH] eliminate ObjCPropertyAttrs an corresponding enums, just use 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 | 6 ------ lib/Parse/ParseObjc.cpp | 18 +++++++++--------- lib/Parse/Parser.cpp | 12 ------------ 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index c47366f431..55b48ae99e 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -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; diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index fa6b1a3fee..10ac42718e 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -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 diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 697d0f6f53..6beaac0151 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -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"); } -- 2.40.0