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/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index bee3936..35c5567 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -1011,15 +1011,9 @@
FromType->getAsObjCObjectPointerType();
if (ToObjCPtr && FromObjCPtr) {
- // Objective C++: We're able to convert between "id" and a pointer
- // to any interface (in both directions).
- if (ToObjCPtr->isObjCIdType() && FromObjCPtr->isObjCIdType()) {
- ConvertedType = ToType;
- return true;
- }
- // Objective C++: Allow conversions between the Objective-C "Class" and a
+ // Objective C++: We're able to convert between "id" or "Class" and a
// pointer to any interface (in both directions).
- if (ToObjCPtr->isObjCClassType() || FromObjCPtr->isObjCClassType()) {
+ if (ToObjCPtr->isObjCBuiltinType() && FromObjCPtr->isObjCBuiltinType()) {
ConvertedType = ToType;
return true;
}
@@ -1169,8 +1163,7 @@
// Objective-C++ conversions are always okay.
// FIXME: We should have a different class of conversions for the
// Objective-C++ implicit conversions.
- if (FromPtrType->isObjCIdType() || ToPtrType->isObjCIdType() ||
- FromPtrType->isObjCClassType() || ToPtrType->isObjCClassType())
+ if (FromPtrType->isObjCBuiltinType() || ToPtrType->isObjCBuiltinType())
return false;
}