aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/InterpBuiltin.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-04-25 11:23:34 +0200
committerGitHub <noreply@github.com>2025-04-25 11:23:34 +0200
commit211b51e4713d814d6fa894f4fc309a364c5642ce (patch)
treec45da24e48f2aa59235f8b30bd280e2e999dd8f0 /clang/lib/AST/ByteCode/InterpBuiltin.cpp
parent5a645109c3a965dcaab08e3485f2fa505e44cde3 (diff)
downloadllvm-211b51e4713d814d6fa894f4fc309a364c5642ce.zip
llvm-211b51e4713d814d6fa894f4fc309a364c5642ce.tar.gz
llvm-211b51e4713d814d6fa894f4fc309a364c5642ce.tar.bz2
[clang][bytecode] Propagate IsVolatile bit to subobjects (#137293)
For ```c++ struct S { constexpr S(int=0) : i(1) {} int i; }; constexpr volatile S vs; ``` reading from `vs.i` is not allowed, even though `i` is not volatile qualified. Propagate the IsVolatile bit down the hierarchy, so we know reading from `vs.i` is a volatile read.
Diffstat (limited to 'clang/lib/AST/ByteCode/InterpBuiltin.cpp')
-rw-r--r--clang/lib/AST/ByteCode/InterpBuiltin.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index d8b320f..770511f 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1595,11 +1595,9 @@ static bool interp__builtin_operator_new(InterpState &S, CodePtr OpPC,
assert(!ElemT);
// Structs etc.
- const Descriptor *Desc = S.P.createDescriptor(
- NewCall, ElemType.getTypePtr(),
- IsArray ? std::nullopt : Descriptor::InlineDescMD,
- /*IsConst=*/false, /*IsTemporary=*/false, /*IsMutable=*/false,
- /*Init=*/nullptr);
+ const Descriptor *Desc =
+ S.P.createDescriptor(NewCall, ElemType.getTypePtr(),
+ IsArray ? std::nullopt : Descriptor::InlineDescMD);
if (IsArray) {
Block *B =