]> granicus.if.org Git - clang/commitdiff
twik to my previous patch for pr7936.
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 21 Aug 2010 17:11:09 +0000 (17:11 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 21 Aug 2010 17:11:09 +0000 (17:11 +0000)
Build qualified version of ObjC pointers (not pointers) when
doing overload resolution.

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

lib/Sema/SemaOverload.cpp

index 6108d5261e605f36d3da697e16f7d3b1c61f8ae8..25a3a2e9d099f794302d88e31c7f9085b18e0e27 100644 (file)
@@ -4171,9 +4171,12 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
     
   QualType PointeeTy;
   const PointerType *PointerTy = Ty->getAs<PointerType>();
+  bool buildObjCPtr = false;
   if (!PointerTy) {
-    if (const ObjCObjectPointerType *PTy = Ty->getAs<ObjCObjectPointerType>())
+    if (const ObjCObjectPointerType *PTy = Ty->getAs<ObjCObjectPointerType>()) {
       PointeeTy = PTy->getPointeeType();
+      buildObjCPtr = true;
+    }
     else
       assert(false && "type was not a pointer type!");
   }
@@ -4200,7 +4203,10 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
     if ((CVR & Qualifiers::Volatile) && !hasVolatile) continue;
     if ((CVR & Qualifiers::Restrict) && !hasRestrict) continue;
     QualType QPointeeTy = Context.getCVRQualifiedType(PointeeTy, CVR);
-    PointerTypes.insert(Context.getPointerType(QPointeeTy));
+    if (!buildObjCPtr)
+      PointerTypes.insert(Context.getPointerType(QPointeeTy));
+    else
+      PointerTypes.insert(Context.getObjCObjectPointerType(QPointeeTy));
   }
 
   return true;