summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2018-10-05 21:53:51 +0000
committerJames Y Knight <jyknight@google.com>2018-10-05 21:53:51 +0000
commit49bf370a8b38a9fde6979fb4be71c06c61671014 (patch)
tree61a1477c9fa6354b7f56fd49fe3489ffa102a79f /clang/lib/AST/ExprConstant.cpp
parentdc97118efe3135cdaa4aa697e9f92ca6ea294fd3 (diff)
downloadbcm5719-llvm-49bf370a8b38a9fde6979fb4be71c06c61671014.tar.gz
bcm5719-llvm-49bf370a8b38a9fde6979fb4be71c06c61671014.zip
Emit CK_NoOp casts in C mode, not just C++.
Previously, it had been using CK_BitCast even for casts that only change const/restrict/volatile. Now it will use CK_Noop where appropriate. This is an alternate solution to r336746. Differential Revision: https://reviews.llvm.org/D52918 llvm-svn: 343892
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 8a2cbdc1871..a2e71ea061e 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -5864,11 +5864,7 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
// permitted in constant expressions in C++11. Bitcasts from cv void* are
// also static_casts, but we disallow them as a resolution to DR1312.
if (!E->getType()->isVoidPointerType()) {
- // If we changed anything other than cvr-qualifiers, we can't use this
- // value for constant folding. FIXME: Qualification conversions should
- // always be CK_NoOp, but we get this wrong in C.
- if (!Info.Ctx.hasCvrSimilarType(E->getType(), E->getSubExpr()->getType()))
- Result.Designator.setInvalid();
+ Result.Designator.setInvalid();
if (SubExpr->getType()->isVoidPointerType())
CCEDiag(E, diag::note_constexpr_invalid_cast)
<< 3 << SubExpr->getType();
OpenPOWER on IntegriCloud