Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/AST/ExprObjC.cpp
Show First 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | QualType ObjCMessageExpr::getCallReturnType(ASTContext &Ctx) const { | ||||
if (const ObjCMethodDecl *MD = getMethodDecl()) { | if (const ObjCMethodDecl *MD = getMethodDecl()) { | ||||
QualType QT = MD->getReturnType(); | QualType QT = MD->getReturnType(); | ||||
if (QT == Ctx.getObjCInstanceType()) { | if (QT == Ctx.getObjCInstanceType()) { | ||||
// instancetype corresponds to expression types. | // instancetype corresponds to expression types. | ||||
return getType(); | return getType(); | ||||
} | } | ||||
return QT; | return QT; | ||||
} | } | ||||
return Ctx.getReferenceQualifiedType(this); | |||||
// Expression type might be different from an expected call return type, | |||||
// as expression type would never be a reference even if call returns a | |||||
// reference. Reconstruct the original expression type. | |||||
QualType QT = getType(); | |||||
switch (getValueKind()) { | |||||
case VK_LValue: | |||||
return Ctx.getLValueReferenceType(QT); | |||||
case VK_XValue: | |||||
return Ctx.getRValueReferenceType(QT); | |||||
case VK_PRValue: | |||||
return QT; | |||||
} | |||||
llvm_unreachable("Unsupported ExprValueKind"); | |||||
} | } | ||||
SourceRange ObjCMessageExpr::getReceiverRange() const { | SourceRange ObjCMessageExpr::getReceiverRange() const { | ||||
switch (getReceiverKind()) { | switch (getReceiverKind()) { | ||||
case Instance: | case Instance: | ||||
return getInstanceReceiver()->getSourceRange(); | return getInstanceReceiver()->getSourceRange(); | ||||
case Class: | case Class: | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |