aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-09 20:05:21 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-09 20:05:21 +0000
commit5c16d635ff67fd8f083a704b7c82607ed49a8ba2 (patch)
treebe5019017c553fe6709fd1e2bcea966ca1e41336 /lib
parente761230ae3751b525cadd8066c74ec278ee4ef57 (diff)
Don't produce 'instancetype' as the type of a message send expression. Map it down to 'id'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139394 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExprObjC.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index f7f00f3f91..faa678505b 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -271,6 +271,13 @@ ObjCMethodDecl *Sema::tryCaptureObjCSelf() {
return method;
}
+static QualType stripObjCInstanceType(ASTContext &Context, QualType T) {
+ if (T == Context.getObjCInstanceType())
+ return Context.getObjCIdType();
+
+ return T;
+}
+
QualType Sema::getMessageSendResultType(QualType ReceiverType,
ObjCMethodDecl *Method,
bool isClassMessage, bool isSuperMessage) {
@@ -283,7 +290,7 @@ QualType Sema::getMessageSendResultType(QualType ReceiverType,
// was a class message send, T is the declared return type of the method
// found
if (Method->isInstanceMethod() && isClassMessage)
- return Method->getSendResultType();
+ return stripObjCInstanceType(Context, Method->getSendResultType());
// - if the receiver is super, T is a pointer to the class of the
// enclosing method definition
@@ -302,7 +309,7 @@ QualType Sema::getMessageSendResultType(QualType ReceiverType,
// T is the declared return type of the method.
if (ReceiverType->isObjCClassType() ||
ReceiverType->isObjCQualifiedClassType())
- return Method->getSendResultType();
+ return stripObjCInstanceType(Context, Method->getSendResultType());
// - if the receiver is id, qualified id, Class, or qualified Class, T
// is the receiver type, otherwise