diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-04-25 11:23:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-25 11:23:34 +0200 |
commit | 211b51e4713d814d6fa894f4fc309a364c5642ce (patch) | |
tree | c45da24e48f2aa59235f8b30bd280e2e999dd8f0 /clang/lib/AST/ByteCode/Program.h | |
parent | 5a645109c3a965dcaab08e3485f2fa505e44cde3 (diff) | |
download | llvm-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/Program.h')
-rw-r--r-- | clang/lib/AST/ByteCode/Program.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/AST/ByteCode/Program.h b/clang/lib/AST/ByteCode/Program.h index ce20626..23ba1bb 100644 --- a/clang/lib/AST/ByteCode/Program.h +++ b/clang/lib/AST/ByteCode/Program.h @@ -119,16 +119,17 @@ public: const Type *SourceTy = nullptr, Descriptor::MetadataSize MDSize = std::nullopt, bool IsConst = false, bool IsTemporary = false, - bool IsMutable = false) { + bool IsMutable = false, + bool IsVolatile = false) { return allocateDescriptor(D, SourceTy, T, MDSize, IsConst, IsTemporary, - IsMutable); + IsMutable, IsVolatile); } /// Creates a descriptor for a composite type. Descriptor *createDescriptor(const DeclTy &D, const Type *Ty, Descriptor::MetadataSize MDSize = std::nullopt, bool IsConst = false, bool IsTemporary = false, - bool IsMutable = false, + bool IsMutable = false, bool IsVolatile = false, const Expr *Init = nullptr); /// Context to manage declaration lifetimes. |