aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-12-15 23:59:41 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-12-15 23:59:41 +0000
commit2514a309204341798f96912ce7a90841bea59727 (patch)
tree7c729e46641baedf645bf13cfb934f001e83926f /lib/AST/Expr.cpp
parent28172a27c0fb69439170aab53127582432e7d5a0 (diff)
Diagnose attempting to assign to a sub-structure of an ivar
using objective-c property. (fixes radar 7449707) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r--lib/AST/Expr.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 139e04b2ed..dcf4411d85 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1047,8 +1047,13 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
// -- If E2 is a non-static data member [...]. If E1 is an
// lvalue, then E1.E2 is an lvalue.
- if (isa<FieldDecl>(Member))
- return m->isArrow() ? LV_Valid : m->getBase()->isLvalue(Ctx);
+ if (isa<FieldDecl>(Member)) {
+ if (m->isArrow())
+ return LV_Valid;
+ Expr *BaseExp = m->getBase();
+ return (BaseExp->getStmtClass() == ObjCPropertyRefExprClass) ?
+ LV_SubObjCPropertySetting : BaseExp->isLvalue(Ctx);
+ }
// -- If it refers to a static member function [...], then
// E1.E2 is an lvalue.
@@ -1065,9 +1070,13 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
// Not an lvalue.
return LV_InvalidExpression;
}
-
+
// C99 6.5.2.3p4
- return m->isArrow() ? LV_Valid : m->getBase()->isLvalue(Ctx);
+ if (m->isArrow())
+ return LV_Valid;
+ Expr *BaseExp = m->getBase();
+ return (BaseExp->getStmtClass() == ObjCPropertyRefExprClass) ?
+ LV_SubObjCPropertySetting : BaseExp->isLvalue(Ctx);
}
case UnaryOperatorClass:
if (cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::Deref)
@@ -1244,6 +1253,7 @@ Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const {
}
return MLV_InvalidExpression;
case LV_MemberFunction: return MLV_MemberFunction;
+ case LV_SubObjCPropertySetting: return MLV_SubObjCPropertySetting;
}
// The following is illegal: