[clang] [CIR] Add binary operators (PR #132420)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 21 14:50:36 PDT 2025
================
@@ -232,6 +231,61 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+LValue CIRGenFunction::emitBinaryOperatorLValue(const BinaryOperator *e) {
+ // Comma expressions just emit their LHS then their RHS as an l-value.
+ if (e->getOpcode() == BO_Comma) {
+ emitIgnoredExpr(e->getLHS());
+ return emitLValue(e->getRHS());
+ }
+
+ if (e->getOpcode() == BO_PtrMemD || e->getOpcode() == BO_PtrMemI) {
+ cgm.errorNYI(e->getSourceRange(), "member pointers");
+ return {};
+ }
+
+ assert(e->getOpcode() == BO_Assign && "unexpected binary l-value");
+
+ // Note that in all of these cases, __block variables need the RHS
+ // evaluated first just in case the variable gets moved by the RHS.
+
+ switch (CIRGenFunction::getEvaluationKind(e->getType())) {
+ case cir::TEK_Scalar: {
+ if (e->getLHS()->getType().getObjCLifetime() !=
----------------
andykaylor wrote:
With have a MissingFeature for this. Can you add that here?
https://github.com/llvm/llvm-project/pull/132420
More information about the cfe-commits
mailing list