diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-14 16:40:48 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-09-14 16:40:48 +0000 |
commit | c3f48cd3f08c384de50a3eeceaa79f4800a35f19 (patch) | |
tree | 314773e3eec5e6fbfa27fd03c3f713c9c5491178 /lib/AST/Expr.cpp | |
parent | de1d26b9c1d8823b173e4d77015ad88b4da70559 (diff) |
Using the property dot-syntax to invoke a non-eixsting
structure-valued setter should cause a user error instead of
crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index fa020de7a3..620b5b8901 100644 --- a/lib/AST/Expr.cpp +++ b/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; } |