diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-04-17 13:39:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-17 13:39:27 +0200 |
commit | 51295d6d56f938b878ca0e2bb0a749eb801e8202 (patch) | |
tree | e581b6530fd921e1b086360e5a42a57ba4f1f06a /clang/lib/AST/ByteCode/Compiler.cpp | |
parent | a84a6f7dd68b218757e192fe21a806c80ef0b63d (diff) | |
download | llvm-51295d6d56f938b878ca0e2bb0a749eb801e8202.zip llvm-51295d6d56f938b878ca0e2bb0a749eb801e8202.tar.gz llvm-51295d6d56f938b878ca0e2bb0a749eb801e8202.tar.bz2 |
[clang][bytecode] Reject assignments in C (#136126)
Similar to what the current interpreter does.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index d3eabc5..3e53f2a 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -863,8 +863,12 @@ bool Compiler<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) { return this->VisitPointerArithBinOp(BO); } - // Assignmentes require us to evalute the RHS first. + // Assignments require us to evalute the RHS first. if (BO->getOpcode() == BO_Assign) { + // We don't support assignments in C. + if (!Ctx.getLangOpts().CPlusPlus) + return this->emitInvalid(BO); + if (!visit(RHS) || !visit(LHS)) return false; if (!this->emitFlip(*LT, *RT, BO)) |