Skip to content

Commit 1eb7f6d

Browse files
committed
[clang] add step limit opt-out to keepEvaluatingAfterFailure, clean up CheckArraySize
1 parent 747856a commit 1eb7f6d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

clang/lib/AST/ByteCode/Interp.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,10 +3686,7 @@ inline bool CheckDestruction(InterpState &S, CodePtr OpPC) {
36863686

36873687
inline bool CheckArraySize(InterpState &S, CodePtr OpPC, uint64_t NumElems) {
36883688
uint64_t Limit = S.getLangOpts().ConstexprStepLimit;
3689-
if (Limit == 0)
3690-
return true;
3691-
3692-
if (NumElems > Limit) {
3689+
if (Limit != 0 && NumElems > Limit) {
36933690
S.FFDiag(S.Current->getSource(OpPC),
36943691
diag::note_constexpr_new_exceeds_limits)
36953692
<< NumElems << Limit;

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,8 @@ namespace {
11891189
/// Should we continue evaluation as much as possible after encountering a
11901190
/// construct which can't be reduced to a value?
11911191
bool keepEvaluatingAfterFailure() const override {
1192-
if (!StepsLeft)
1192+
uint64_t Limit = Ctx.getLangOpts().ConstexprStepLimit;
1193+
if (Limit != 0 && !StepsLeft)
11931194
return false;
11941195

11951196
switch (EvalMode) {

0 commit comments

Comments
 (0)