aboutsummaryrefslogtreecommitdiff
path: root/clang/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
commit5fa2ef4445fa674f93fd87e6a1fc8f9582724b5c (patch)
treecf267b7cb244a2cdd92f3f4bc705e62eac634812 /clang/lib/AST/ExprClassification.cpp
parent8c69c96dc99d91cc5a391ad026f46a30b062fbed (diff)
downloadllvm-5fa2ef4445fa674f93fd87e6a1fc8f9582724b5c.zip
llvm-5fa2ef4445fa674f93fd87e6a1fc8f9582724b5c.tar.gz
llvm-5fa2ef4445fa674f93fd87e6a1fc8f9582724b5c.tar.bz2
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. llvm-svn: 152593
Diffstat (limited to 'clang/lib/AST/ExprClassification.cpp')
-rw-r--r--clang/lib/AST/ExprClassification.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp
index 6697c9d..b091e19 100644
--- a/clang/lib/AST/ExprClassification.cpp
+++ b/clang/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;