aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/release-binaries.yml6
-rw-r--r--clang/lib/AST/Interp/Compiler.cpp16
-rw-r--r--clang/test/AST/Interp/eval-order.cpp5
3 files changed, 20 insertions, 7 deletions
diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index b1b046d..7cc8b7a 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -57,6 +57,12 @@ jobs:
release-binary-filename: ${{ steps.vars.outputs.release-binary-filename }}
steps:
+ # It's good practice to use setup-python, but this is also required on macos-14
+ # due to https://github.com/actions/runner-images/issues/10385
+ - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
+ with:
+ python-version: '3.12'
+
- name: Checkout LLVM
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
diff --git a/clang/lib/AST/Interp/Compiler.cpp b/clang/lib/AST/Interp/Compiler.cpp
index ada22b5..d9db1c7 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -733,8 +733,8 @@ bool Compiler<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
}
// Typecheck the args.
- std::optional<PrimType> LT = classify(LHS->getType());
- std::optional<PrimType> RT = classify(RHS->getType());
+ std::optional<PrimType> LT = classify(LHS);
+ std::optional<PrimType> RT = classify(RHS);
std::optional<PrimType> T = classify(BO->getType());
// Special case for C++'s three-way/spaceship operator <=>, which
@@ -769,8 +769,16 @@ bool Compiler<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
return this->VisitPointerArithBinOp(BO);
}
- if (!visit(LHS) || !visit(RHS))
- return false;
+ // Assignmentes require us to evalute the RHS first.
+ if (BO->getOpcode() == BO_Assign) {
+ if (!visit(RHS) || !visit(LHS))
+ return false;
+ if (!this->emitFlip(*LT, *RT, BO))
+ return false;
+ } else {
+ if (!visit(LHS) || !visit(RHS))
+ return false;
+ }
// For languages such as C, cast the result of one
// of our comparision opcodes to T (which is usually int).
diff --git a/clang/test/AST/Interp/eval-order.cpp b/clang/test/AST/Interp/eval-order.cpp
index d9cfd0b..c78c506 100644
--- a/clang/test/AST/Interp/eval-order.cpp
+++ b/clang/test/AST/Interp/eval-order.cpp
@@ -45,7 +45,7 @@ namespace EvalOrder {
}
template <typename T> constexpr T &&b(T &&v) {
if (!done_a)
- throw "wrong"; // expected-note 4{{not valid}}
+ throw "wrong"; // expected-note 3{{not valid}}
done_b = true;
return (T &&)v;
}
@@ -78,8 +78,7 @@ namespace EvalOrder {
SEQ(A(f)(B(1), B(2), B(3)));
// Rule 5: b = a, b @= a
- SEQ(B(lvalue<int>().get()) = A(0)); // expected-error {{not an integral constant expression}} FIXME \
- // expected-note 2{{in call to}}
+ SEQ(B(lvalue<int>().get()) = A(0));
SEQ(B(lvalue<UserDefined>().get()) = A(ud)); // expected-error {{not an integral constant expression}} FIXME \
// expected-note 2{{in call to}}
SEQ(B(lvalue<int>().get()) += A(0));