Tweak implementation for allowing ObjC builtin type redefinitions.

- Replace string comparisons with pre-defined idents.
- Avoid calling isBuiltinObjCType() to avoid two checks. 
- Remove isBuiltinObjCType(), since it was only used in Sema::MergeTypeDefDecl().
- Have Sema::MergeTypeDefDecl() set the new type.

This is a moidified version of an patch by David Chisnall.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55990 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 96f6e53..1397742 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -146,6 +146,10 @@
   /// 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"
+
   /// Translation Unit Scope - useful to Objective-C actions that need
   /// to lookup file scope declarations in the "ordinary" C decl namespace.
   /// For example, user-defined classes, built-in "id" type, etc.
@@ -358,10 +362,6 @@
   bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, 
                                   const ObjCMethodDecl *PrevMethod); 
 
-  /// isBuiltinObjCType - Returns true of the type is "id", "SEL", "Class"
-  /// or "Protocol".
-  bool isBuiltinObjCType(TypedefDecl *TD);
-
   /// AddInstanceMethodToGlobalPool - All instance methods in a translation
   /// unit are added to a global pool. This allows us to efficiently associate
   /// a selector with a method declaraation for purposes of typechecking