]> granicus.if.org Git - clang/commitdiff
remove some other identifiers that are looked up really early and only
authorChris Lattner <sabre@nondot.org>
Thu, 20 Nov 2008 05:41:43 +0000 (05:41 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 20 Nov 2008 05:41:43 +0000 (05:41 +0000)
used in one cold place.

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

lib/Sema/Sema.cpp
lib/Sema/Sema.h
lib/Sema/SemaDecl.cpp

index dcb3af31b08fdea7fa1e02b7da442c2eb2d527b4..2b33bf4046fc81a4e666863d560f1b557f3a05dc 100644 (file)
@@ -103,12 +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");
 
-  // ObjC builtin typedef names.
-  Ident_id = &IT.get("id");
-  Ident_Class = &IT.get("Class");
-  Ident_SEL = &IT.get("SEL");
-  Ident_Protocol = &IT.get("Protocol");
-
   Ident_StdNs = &IT.get("std");
   Ident_TypeInfo = 0;
   StdNamespace = 0;
index db75513b1a54e5b9e7774f7485302f9b8bef06d8..ab465247c89406cbc53009597d5fe3deab5b7fcb 100644 (file)
@@ -192,10 +192,6 @@ public:
   /// This list is populated upon the creation of a Sema object.    
   IdentifierInfo* KnownFunctionIDs[id_num_known_functions];
 
-  /// Identifiers for builtin ObjC typedef names.
-  IdentifierInfo *Ident_id, *Ident_Class;     // "id", "Class"
-  IdentifierInfo *Ident_SEL, *Ident_Protocol; // "SEL", "Protocol"
-
   /// Identifiers used by the C++ language
   IdentifierInfo *Ident_StdNs; // "std"
   IdentifierInfo *Ident_TypeInfo; // "type_info" - lazily created
index 941f40fa52a769600f9bd91aea6f90393ee2f6b4..e7a9c0ee728a2892d891bc8d287b2c5f30007ef0 100644 (file)
@@ -294,17 +294,27 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
   // Allow multiple definitions for ObjC built-in typedefs.
   // FIXME: Verify the underlying types are equivalent!
   if (getLangOptions().ObjC1) {
-    const IdentifierInfo *typeIdent = New->getIdentifier();
-    if (typeIdent == Ident_id) {
+    const IdentifierInfo *TypeID = New->getIdentifier();
+    switch (TypeID->getLength()) {
+    default: break;
+    case 2: 
+      if (!TypeID->isStr("id"))
+        break;
       Context.setObjCIdType(New);
       return New;
-    } else if (typeIdent == Ident_Class) {
+    case 5:
+      if (!TypeID->isStr("Class"))
+        break;
       Context.setObjCClassType(New);
       return New;
-    } else if (typeIdent == Ident_SEL) {
+    case 3:
+      if (!TypeID->isStr("SEL"))
+        break;
       Context.setObjCSelType(New);
       return New;
-    } else if (typeIdent == Ident_Protocol) {
+    case 8:
+      if (!TypeID->isStr("Protocol"))
+        break;
       Context.setObjCProtoType(New->getUnderlyingType());
       return New;
     }