Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective).

This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-).

This patch also adds Type::isObjCBuiltinType().

This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75808 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 66d2cdc..19d8908 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2338,9 +2338,11 @@
                        << IDecl->getDeclName() << &Member
                        << BaseExpr->getSourceRange());
   }
-  // Handle properties on qualified "id" protocols.
-  const ObjCObjectPointerType *QIdTy;
-  if (OpKind == tok::period && (QIdTy = BaseType->getAsObjCQualifiedIdType())) {
+  // Handle properties on 'id' and qualified "id".
+  if (OpKind == tok::period && (BaseType->isObjCIdType() || 
+                                BaseType->isObjCQualifiedIdType())) {
+    const ObjCObjectPointerType *QIdTy = BaseType->getAsObjCObjectPointerType();
+    
     // Check protocols on qualified interfaces.
     Selector Sel = PP.getSelectorTable().getNullarySelector(&Member);
     if (Decl *PMDecl = FindGetterNameDecl(QIdTy, Member, Sel, Context)) {
@@ -3531,6 +3533,8 @@
       return CheckPointeeTypesForAssignment(lhptee, rhptee);
     }
     if (rhsType->isObjCObjectPointerType()) {
+      if (lhsType->isObjCBuiltinType() || rhsType->isObjCBuiltinType())
+        return Compatible;
       QualType lhptee = lhsType->getAsObjCObjectPointerType()->getPointeeType();
       QualType rhptee = rhsType->getAsObjCObjectPointerType()->getPointeeType();
       return CheckPointeeTypesForAssignment(lhptee, rhptee);
@@ -4279,11 +4283,6 @@
         Diag(Loc, diag::ext_typecheck_comparison_of_distinct_pointers)
           << lType << rType << lex->getSourceRange() << rex->getSourceRange();
       }
-      if (lType->isObjCQualifiedIdType() && rType->isObjCQualifiedIdType()) {
-        if (!ObjCQualifiedIdTypesAreCompatible(lType, rType, true))
-          Diag(Loc, diag::warn_incompatible_qualified_id_operands)
-            << lType << rType << lex->getSourceRange() << rex->getSourceRange();
-      }
       ImpCastExprToType(rex, lType);
       return ResultTy;
     }