diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-04-23 18:52:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-23 18:52:35 +0200 |
commit | 1b6cbaa7b64f54b127d139d653468e213bae007e (patch) | |
tree | 056125775fc6227d03bee4e84841b1e7fda2871e /clang/lib/AST/ByteCode/Compiler.cpp | |
parent | 83c309b90550aa768ff9aa11b70898ee2c56b71e (diff) | |
download | llvm-1b6cbaa7b64f54b127d139d653468e213bae007e.zip llvm-1b6cbaa7b64f54b127d139d653468e213bae007e.tar.gz llvm-1b6cbaa7b64f54b127d139d653468e213bae007e.tar.bz2 |
[clang][bytecode] Refine diagnostics for volatile reads (#136857)
Differentiate between a volarile read via a lvalue-to-rvalue cast of a
volatile qualified subexpression and a read from a pointer with a
volatile base object.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 7cba0e8..65d87cd 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -210,6 +210,9 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) { switch (CE->getCastKind()) { case CK_LValueToRValue: { + if (SubExpr->getType().isVolatileQualified()) + return this->emitInvalidCast(CastKind::Volatile, /*Fatal=*/true, CE); + std::optional<PrimType> SubExprT = classify(SubExpr->getType()); // Prepare storage for the result. if (!Initializing && !SubExprT) { |