summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-09-14 16:40:48 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-09-14 16:40:48 +0000
commitcb1c19147fa8cf48d75dc9c6efa9c8ed1d4984d4 (patch)
treedecc76ea74bb14af126564536a94df64756e04be /clang/lib/AST/Expr.cpp
parentd8530f35f52b9199ccb37debd3f9821a764b47df (diff)
downloadbcm5719-llvm-cb1c19147fa8cf48d75dc9c6efa9c8ed1d4984d4.tar.gz
bcm5719-llvm-cb1c19147fa8cf48d75dc9c6efa9c8ed1d4984d4.zip
Using the property dot-syntax to invoke a non-eixsting
structure-valued setter should cause a user error instead of crash. llvm-svn: 81769
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index fa020de7a37..620b5b89016 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1061,12 +1061,18 @@ Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const {
// void takeclosure(void (^C)(void));
// void func() { int x = 1; takeclosure(^{ x = 7; }); }
//
- if (isa<BlockDeclRefExpr>(this)) {
- const BlockDeclRefExpr *BDR = cast<BlockDeclRefExpr>(this);
+ if (const BlockDeclRefExpr *BDR = dyn_cast<BlockDeclRefExpr>(this)) {
if (!BDR->isByRef() && isa<VarDecl>(BDR->getDecl()))
return MLV_NotBlockQualified;
}
-
+
+ // Assigning to an 'implicit' property?
+ if (const ObjCImplicitSetterGetterRefExpr* Expr =
+ dyn_cast<ObjCImplicitSetterGetterRefExpr>(this)) {
+ if (Expr->getSetterMethod() == 0)
+ return MLV_NoSetterProperty;
+ }
+
QualType CT = Ctx.getCanonicalType(getType());
if (CT.isConstQualified())
@@ -1081,13 +1087,6 @@ Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const {
return MLV_ConstQualified;
}
- // Assigning to an 'implicit' property?
- else if (isa<ObjCImplicitSetterGetterRefExpr>(this)) {
- const ObjCImplicitSetterGetterRefExpr* Expr =
- cast<ObjCImplicitSetterGetterRefExpr>(this);
- if (Expr->getSetterMethod() == 0)
- return MLV_NoSetterProperty;
- }
return MLV_Valid;
}
OpenPOWER on IntegriCloud