aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-08-21 00:10:36 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-08-21 00:10:36 +0000
commit2e2acec770a414bf1ebaf2664a752f67494200d1 (patch)
treeaf3681792baec197bf3a29bfb2596324e2f8d566 /lib/Sema/SemaOverload.cpp
parenta60786b46eaa4766bb57fb3ca4e0191b3f73e42a (diff)
patch to support comparison involving
objctive-c pointer conversions. Fixes pr7936. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 78014a781e..6108d5261e 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -4168,11 +4168,18 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
// Insert this type.
if (!PointerTypes.insert(Ty))
return false;
-
+
+ QualType PointeeTy;
const PointerType *PointerTy = Ty->getAs<PointerType>();
- assert(PointerTy && "type was not a pointer type!");
-
- QualType PointeeTy = PointerTy->getPointeeType();
+ if (!PointerTy) {
+ if (const ObjCObjectPointerType *PTy = Ty->getAs<ObjCObjectPointerType>())
+ PointeeTy = PTy->getPointeeType();
+ else
+ assert(false && "type was not a pointer type!");
+ }
+ else
+ PointeeTy = PointerTy->getPointeeType();
+
// Don't add qualified variants of arrays. For one, they're not allowed
// (the qualifier would sink to the element type), and for another, the
// only overload situation where it matters is subscript or pointer +- int,
@@ -4268,8 +4275,9 @@ BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
// If we're dealing with an array type, decay to the pointer.
if (Ty->isArrayType())
Ty = SemaRef.Context.getArrayDecayedType(Ty);
-
- if (Ty->getAs<PointerType>()) {
+ if (Ty->isObjCIdType() || Ty->isObjCClassType())
+ PointerTypes.insert(Ty);
+ else if (Ty->getAs<PointerType>() || Ty->getAs<ObjCObjectPointerType>()) {
// Insert our type, and its more-qualified variants, into the set
// of types.
if (!AddPointerWithMoreQualifiedTypeVariants(Ty, VisibleQuals))