r213820 - Replace r213816's fix with a different one. It's not meaningful to call
Richard Smith
richard-llvm at metafoo.co.uk
Wed Jul 23 16:50:25 PDT 2014
Author: rsmith
Date: Wed Jul 23 18:50:25 2014
New Revision: 213820
URL: http://llvm.org/viewvc/llvm-project?rev=213820&view=rev
Log:
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.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=213820&r1=213819&r2=213820&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Jul 23 18:50:25 2014
@@ -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 CheckLValueConstantExpressio
}
// 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;
More information about the cfe-commits
mailing list