diff options
author | John McCall <rjmccall@apple.com> | 2010-05-13 08:39:13 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-05-13 08:39:13 +0000 |
commit | 5d7c29a278c4ef95d68c3a0d059ef5fe59b8bb45 (patch) | |
tree | 4aed3f8c1ca98a0f30fc175f9a688a12685ddf87 | |
parent | 8e98ac162ace2d8bd571d594c66665b7f5e51814 (diff) |
Rebuild builtin_id * as an ObjCObjectPointerType, where builtin_id is the
magic type that 'id' is a pointer to.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103708 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/TreeTransform.h | 18 | ||||
-rw-r--r-- | test/SemaObjCXX/deduction.mm | 4 |
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 4923480737..3515261733 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -2445,16 +2445,24 @@ QualType TreeTransform<Derived>::TransformPointerType(TypeLocBuilder &TLB, return QualType(); QualType Result = TL.getType(); - if (PointeeType->isObjCInterfaceType()) { + if (PointeeType->isObjCInterfaceType() || + PointeeType->isSpecificBuiltinType(BuiltinType::ObjCId)) { // A dependent pointer type 'T *' has is being transformed such // that an Objective-C class type is being replaced for 'T'. The // resulting pointer type is an ObjCObjectPointerType, not a // PointerType. - const ObjCInterfaceType *IFace = PointeeType->getAs<ObjCInterfaceType>(); + ObjCProtocolDecl **Protocols = 0; + unsigned NumProtocols = 0; + + if (const ObjCInterfaceType *IFace + = PointeeType->getAs<ObjCInterfaceType>()) { + Protocols = const_cast<ObjCProtocolDecl**>(IFace->qual_begin()); + NumProtocols = IFace->getNumProtocols(); + } + Result = SemaRef.Context.getObjCObjectPointerType(PointeeType, - const_cast<ObjCProtocolDecl **>( - IFace->qual_begin()), - IFace->getNumProtocols()); + Protocols, + NumProtocols); ObjCObjectPointerTypeLoc NewT = TLB.push<ObjCObjectPointerTypeLoc>(Result); NewT.setStarLoc(TL.getSigilLoc()); diff --git a/test/SemaObjCXX/deduction.mm b/test/SemaObjCXX/deduction.mm index 2c153aa9a6..0d2fc06dc3 100644 --- a/test/SemaObjCXX/deduction.mm +++ b/test/SemaObjCXX/deduction.mm @@ -21,4 +21,8 @@ namespace test0 { void test(NSString *S) { RetainPtr<NSString*> ptr(S); } + + void test(id S) { + RetainPtr<id> ptr(S); + } } |