Skip to content

Commit 0f29d93

Browse files
committed
fix review
1 parent 418d6ba commit 0f29d93

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4033,8 +4033,8 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
40334033
assert((isa<ConstantArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
40344034
"vla in literal type?");
40354035
uint64_t Index = Sub.Entries[I].getAsArrayIndex();
4036-
if (isa<ConstantArrayType>(AT) &&
4037-
cast<ConstantArrayType>(AT)->getSize().ule(Index)) {
4036+
if (const auto *CAT = dyn_cast<ConstantArrayType>(AT);
4037+
CAT && CAT->getSize().ule(Index)) {
40384038
// Note, it should not be possible to form a pointer with a valid
40394039
// designator which points more than one past the end of the array.
40404040
if (Info.getLangOpts().CPlusPlus11)
@@ -4050,8 +4050,8 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
40504050
if (O->getArrayInitializedElts() > Index)
40514051
O = &O->getArrayInitializedElt(Index);
40524052
else if (!isRead(handler.AccessKind)) {
4053-
if (isa<ConstantArrayType>(AT) &&
4054-
!CheckArraySize(Info, cast<ConstantArrayType>(AT), E->getExprLoc()))
4053+
if (const auto *CAT = dyn_cast<ConstantArrayType>(AT);
4054+
CAT && !CheckArraySize(Info, CAT, E->getExprLoc()))
40554055
return handler.failed();
40564056

40574057
expandArray(*O, Index);

0 commit comments

Comments
 (0)