[cfe-commits] r59708 - in /cfe/trunk/lib/Sema: Sema.cpp Sema.h SemaExpr.cpp SemaExprObjC.cpp

Chris Lattner sabre at nondot.org
Wed Nov 19 21:35:30 PST 2008


Author: lattner
Date: Wed Nov 19 23:35:30 2008
New Revision: 59708

URL: http://llvm.org/viewvc/llvm-project?rev=59708&view=rev
Log:
instead of looking up super at startup time, 
just check for it when needed.  It doesn't incur real cost
in any hot paths.

Modified:
    cfe/trunk/lib/Sema/Sema.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprObjC.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=59708&r1=59707&r2=59708&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Wed Nov 19 23:35:30 2008
@@ -103,8 +103,6 @@
   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");

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=59708&r1=59707&r2=59708&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Nov 19 23:35:30 2008
@@ -192,9 +192,6 @@
   /// 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"

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=59708&r1=59707&r2=59708&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Nov 19 23:35:30 2008
@@ -400,7 +400,7 @@
       }
     }
     // 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);

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=59708&r1=59707&r2=59708&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Wed Nov 19 23:35:30 2008
@@ -185,7 +185,7 @@
   ObjCInterfaceDecl* ClassDecl = 0;
   bool isSuper = false;
   
-  if (receiverName == SuperID) {
+  if (receiverName->isStr("super")) {
     if (getCurMethodDecl()) {
       isSuper = true;
       ClassDecl = getCurMethodDecl()->getClassInterface()->getSuperClass();





More information about the cfe-commits mailing list