[clang] 17a7114 - [clang][bytecode] Use InterpState::InConstantContext directly (#157224)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 8 07:29:48 PDT 2025


Author: Timm Baeder
Date: 2025-09-08T16:29:44+02:00
New Revision: 17a7114054ff13a4e58c3fd34a1c9f000033f756

URL: https://github.com/llvm/llvm-project/commit/17a7114054ff13a4e58c3fd34a1c9f000033f756
DIFF: https://github.com/llvm/llvm-project/commit/17a7114054ff13a4e58c3fd34a1c9f000033f756.diff

LOG: [clang][bytecode] Use InterpState::InConstantContext directly (#157224)

Instead of referring to the EvalInfo's flag.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/InterpState.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/InterpState.cpp b/clang/lib/AST/ByteCode/InterpState.cpp
index 131d84b300953..1ec4191d2ba37 100644
--- a/clang/lib/AST/ByteCode/InterpState.cpp
+++ b/clang/lib/AST/ByteCode/InterpState.cpp
@@ -21,6 +21,7 @@ InterpState::InterpState(State &Parent, Program &P, InterpStack &Stk,
                          Context &Ctx, SourceMapper *M)
     : Parent(Parent), M(M), P(P), Stk(Stk), Ctx(Ctx), BottomFrame(*this),
       Current(&BottomFrame) {
+  InConstantContext = Parent.InConstantContext;
   CheckingPotentialConstantExpression =
       Parent.CheckingPotentialConstantExpression;
   CheckingForUndefinedBehavior = Parent.CheckingForUndefinedBehavior;
@@ -31,6 +32,7 @@ InterpState::InterpState(State &Parent, Program &P, InterpStack &Stk,
     : Parent(Parent), M(nullptr), P(P), Stk(Stk), Ctx(Ctx),
       BottomFrame(*this, Func, nullptr, CodePtr(), Func->getArgSize()),
       Current(&BottomFrame) {
+  InConstantContext = Parent.InConstantContext;
   CheckingPotentialConstantExpression =
       Parent.CheckingPotentialConstantExpression;
   CheckingForUndefinedBehavior = Parent.CheckingForUndefinedBehavior;
@@ -40,7 +42,7 @@ bool InterpState::inConstantContext() const {
   if (ConstantContextOverride)
     return *ConstantContextOverride;
 
-  return Parent.InConstantContext;
+  return InConstantContext;
 }
 
 InterpState::~InterpState() {


        


More information about the cfe-commits mailing list