[cfe-commits] r139394 - /cfe/trunk/lib/Sema/SemaExprObjC.cpp
Douglas Gregor
dgregor at apple.com
Fri Sep 9 13:05:21 PDT 2011
Author: dgregor
Date: Fri Sep 9 15:05:21 2011
New Revision: 139394
URL: http://llvm.org/viewvc/llvm-project?rev=139394&view=rev
Log:
Don't produce 'instancetype' as the type of a message send expression. Map it down to 'id'.
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=139394&r1=139393&r2=139394&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Sep 9 15:05:21 2011
@@ -271,6 +271,13 @@
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 @@
// 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 @@
// 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
More information about the cfe-commits
mailing list