aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-04-17 12:50:28 +0200
committerGitHub <noreply@github.com>2025-04-17 12:50:28 +0200
commit90ddb5444030b8d7cca6e91a27994e4fa9a6525d (patch)
tree9d1e3da299aa15e28d8aa411485647c468b699df /clang/lib/AST/ByteCode/Compiler.cpp
parentd69ee885cccecb49f0b288ec634186c35c8ecfb5 (diff)
downloadllvm-90ddb5444030b8d7cca6e91a27994e4fa9a6525d.zip
llvm-90ddb5444030b8d7cca6e91a27994e4fa9a6525d.tar.gz
llvm-90ddb5444030b8d7cca6e91a27994e4fa9a6525d.tar.bz2
[clang][bytecode] Enter a non-constant context when revisiting (#136104)
Otherwise, things like __builtin_is_constant_evaluated() return the wrong value.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 157e306..d3eabc5 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -6466,8 +6466,13 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
// In case we need to re-visit a declaration.
auto revisit = [&](const VarDecl *VD) -> bool {
+ if (!this->emitPushCC(VD->hasConstantInitialization(), E))
+ return false;
auto VarState = this->visitDecl(VD, /*IsConstexprUnknown=*/true);
+ if (!this->emitPopCC(E))
+ return false;
+
if (VarState.notCreated())
return true;
if (!VarState)