summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp11
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp15
2 files changed, 20 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 56ad9b42410..e2a6d346164 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -7097,8 +7097,15 @@ void Sema::ConvertPropertyForRValue(Expr *&E) {
ExprValueKind VK = VK_RValue;
if (PRE->isImplicitProperty()) {
- QualType Result = PRE->getImplicitPropertyGetter()->getResultType();
- VK = Expr::getValueKindForType(Result);
+ if (const ObjCMethodDecl *GetterMethod =
+ PRE->getImplicitPropertyGetter()) {
+ QualType Result = GetterMethod->getResultType();
+ VK = Expr::getValueKindForType(Result);
+ }
+ else {
+ Diag(PRE->getLocation(), diag::err_getter_not_found)
+ << PRE->getBase()->getType();
+ }
}
E = ImplicitCastExpr::Create(Context, E->getType(), CK_GetObjCProperty,
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index bbb047990bb..f4c593b0dae 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -439,8 +439,15 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
if (Setter && DiagnoseUseOfDecl(Setter, MemberLoc))
return ExprError();
- if (Getter) {
- QualType PType = Getter->getSendResultType();
+ if (Getter || Setter) {
+ QualType PType;
+ if (Getter)
+ PType = Getter->getSendResultType();
+ else {
+ ParmVarDecl *ArgDecl = *Setter->param_begin();
+ PType = ArgDecl->getType();
+ }
+
ExprValueKind VK = VK_LValue;
ExprObjectKind OK = OK_ObjCProperty;
if (!getLangOptions().CPlusPlus && !PType.hasQualifiers() &&
@@ -476,9 +483,9 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
Diag(MemberLoc, diag::err_property_not_found)
<< MemberName << QualType(OPT, 0);
- if (Setter && !Getter)
+ if (Setter)
Diag(Setter->getLocation(), diag::note_getter_unavailable)
- << MemberName << BaseExpr->getSourceRange();
+ << MemberName << BaseExpr->getSourceRange();
return ExprError();
}
OpenPOWER on IntegriCloud