aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ExprClassification.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-03-13 00:37:01 +0000
committerJohn McCall <rjmccall@apple.com>2012-03-13 00:37:01 +0000
commit78dae24600a877f52dbb6e58bfd5778754a00974 (patch)
treec04e7d5b386b2fd083c0dff74a2d34517e444680 /lib/AST/ExprClassification.cpp
parent8ce6d214aef65ea1421eb11e84980dfa4da429b8 (diff)
Alternate fix to PR12248: put Sema in charge of special-casing
the diagnostic for assigning to a copied block capture. This has the pleasant side-effect of letting us special-case the diagnostic for assigning to a copied lambda capture as well, without introducing a new non-modifiable enumerator for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprClassification.cpp')
-rw-r--r--lib/AST/ExprClassification.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/AST/ExprClassification.cpp b/lib/AST/ExprClassification.cpp
index 6697c9d7da..b091e19a8a 100644
--- a/lib/AST/ExprClassification.cpp
+++ b/lib/AST/ExprClassification.cpp
@@ -567,18 +567,8 @@ static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E,
CanQualType CT = Ctx.getCanonicalType(E->getType());
// Const stuff is obviously not modifiable.
- if (CT.isConstQualified()) {
- // Special-case variables captured by blocks to get an improved
- // diagnostic.
- if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
- if (DRE->refersToEnclosingLocal() &&
- isa<VarDecl>(DRE->getDecl()) &&
- cast<VarDecl>(DRE->getDecl())->hasLocalStorage() &&
- !DRE->getDecl()->hasAttr<BlocksAttr>())
- return Cl::CM_NotBlockQualified;
- }
+ if (CT.isConstQualified())
return Cl::CM_ConstQualified;
- }
// Arrays are not modifiable, only their elements are.
if (CT->isArrayType())
@@ -645,7 +635,6 @@ Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const {
case Cl::CM_Function: return MLV_NotObjectType;
case Cl::CM_LValueCast:
llvm_unreachable("CM_LValueCast and CL_LValue don't match");
- case Cl::CM_NotBlockQualified: return MLV_NotBlockQualified;
case Cl::CM_NoSetterProperty: return MLV_NoSetterProperty;
case Cl::CM_ConstQualified: return MLV_ConstQualified;
case Cl::CM_ArrayType: return MLV_ArrayType;