summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-07-23 23:50:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-07-23 23:50:25 +0000
commit33b44ab2b7f4e92ad5a2b879d0160214c0d10321 (patch)
tree7b6d6169a68e6a14e89a0e15d79c47a6f123b715 /clang/lib/AST/ExprConstant.cpp
parent2de13f620d0356761f1a0c143b7ed5538876f922 (diff)
downloadbcm5719-llvm-33b44ab2b7f4e92ad5a2b879d0160214c0d10321.tar.gz
bcm5719-llvm-33b44ab2b7f4e92ad5a2b879d0160214c0d10321.zip
Replace r213816's fix with a different one. It's not meaningful to call
isOnePastTheEnd on an invalid designator, so assert and push the check into the one caller that wasn't already checking. llvm-svn: 213820
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 11789aa037f..9bd630a272f 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -201,8 +201,7 @@ namespace {
/// Determine whether this is a one-past-the-end pointer.
bool isOnePastTheEnd() const {
- if (Invalid)
- return false;
+ assert(!Invalid);
if (IsOnePastTheEnd)
return true;
if (MostDerivedArraySize &&
@@ -1310,7 +1309,7 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
}
// Does this refer one past the end of some object?
- if (Designator.isOnePastTheEnd()) {
+ if (!Designator.Invalid && Designator.isOnePastTheEnd()) {
const ValueDecl *VD = Base.dyn_cast<const ValueDecl*>();
Info.Diag(Loc, diag::note_constexpr_past_end, 1)
<< !Designator.Entries.empty() << !!VD << VD;
OpenPOWER on IntegriCloud