From: Chris Lattner Date: Thu, 20 Nov 2008 05:35:30 +0000 (+0000) Subject: instead of looking up super at startup time, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8469265156c6344fa1100a6a7bf6349acc187d9f;p=clang instead of looking up super at startup time, just check for it when needed. It doesn't incur real cost in any hot paths. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59708 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 1a9e1a062c..dcb3af31b0 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -103,8 +103,6 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer) KnownFunctionIDs[id_vsnprintf_chk] = &IT.get("__builtin___vsnprintf_chk"); KnownFunctionIDs[id_vprintf] = &IT.get("vprintf"); - SuperID = &IT.get("super"); - // ObjC builtin typedef names. Ident_id = &IT.get("id"); Ident_Class = &IT.get("Class"); diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index ded90e8103..db75513b1a 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -192,9 +192,6 @@ public: /// This list is populated upon the creation of a Sema object. IdentifierInfo* KnownFunctionIDs[id_num_known_functions]; - /// SuperID - Identifier for "super" used for Objective-C checking. - IdentifierInfo* SuperID; - /// Identifiers for builtin ObjC typedef names. IdentifierInfo *Ident_id, *Ident_Class; // "id", "Class" IdentifierInfo *Ident_SEL, *Ident_Protocol; // "SEL", "Protocol" diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 147b4c8323..12f059e11a 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -400,7 +400,7 @@ Sema::ExprResult Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, } } // Needed to implement property "super.method" notation. - if (SD == 0 && II == SuperID) { + if (SD == 0 && II->isStr("super")) { QualType T = Context.getPointerType(Context.getObjCInterfaceType( getCurMethodDecl()->getClassInterface())); return new ObjCSuperExpr(Loc, T); diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 786d74c950..0684674c35 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -185,7 +185,7 @@ Sema::ExprResult Sema::ActOnClassMessage( ObjCInterfaceDecl* ClassDecl = 0; bool isSuper = false; - if (receiverName == SuperID) { + if (receiverName->isStr("super")) { if (getCurMethodDecl()) { isSuper = true; ClassDecl = getCurMethodDecl()->getClassInterface()->getSuperClass();