Skip to content

Commit 17a7114

Browse files
authored
[clang][bytecode] Use InterpState::InConstantContext directly (#157224)
Instead of referring to the EvalInfo's flag.
1 parent 85aebdb commit 17a7114

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/lib/AST/ByteCode/InterpState.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ InterpState::InterpState(State &Parent, Program &P, InterpStack &Stk,
2121
Context &Ctx, SourceMapper *M)
2222
: Parent(Parent), M(M), P(P), Stk(Stk), Ctx(Ctx), BottomFrame(*this),
2323
Current(&BottomFrame) {
24+
InConstantContext = Parent.InConstantContext;
2425
CheckingPotentialConstantExpression =
2526
Parent.CheckingPotentialConstantExpression;
2627
CheckingForUndefinedBehavior = Parent.CheckingForUndefinedBehavior;
@@ -31,6 +32,7 @@ InterpState::InterpState(State &Parent, Program &P, InterpStack &Stk,
3132
: Parent(Parent), M(nullptr), P(P), Stk(Stk), Ctx(Ctx),
3233
BottomFrame(*this, Func, nullptr, CodePtr(), Func->getArgSize()),
3334
Current(&BottomFrame) {
35+
InConstantContext = Parent.InConstantContext;
3436
CheckingPotentialConstantExpression =
3537
Parent.CheckingPotentialConstantExpression;
3638
CheckingForUndefinedBehavior = Parent.CheckingForUndefinedBehavior;
@@ -40,7 +42,7 @@ bool InterpState::inConstantContext() const {
4042
if (ConstantContextOverride)
4143
return *ConstantContextOverride;
4244

43-
return Parent.InConstantContext;
45+
return InConstantContext;
4446
}
4547

4648
InterpState::~InterpState() {

0 commit comments

Comments
 (0)