[PATCH] D123680: Add support for ignored bitfield conditional codegen.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 09:09:41 PDT 2022


efriedma added a comment.

This is basically what I expected; the general approach seems fine.



================
Comment at: clang/lib/CodeGen/CGExpr.cpp:200
+          E->IgnoreParenNoopCasts(getContext()))) {
+    if (CondOp->getObjectKind() == OK_BitField)
+      return EmitIgnoredConditionalOperator(CondOp);
----------------
Is there some reason we need to special-case bitfields here?


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:4635
+  eval.begin(CGF);
+  Info.LHS = EmitLValueOrThrowExpression(CGF, E->getTrueExpr());
+  eval.end(CGF);
----------------
If we're calling this from EmitIgnoredConditionalOperator, should we be calling back into EmitIgnoredExpr, instead of using EmitLValueOrThrowExpression?  Consider, e.g. `cond ? s1.field1 = val1 : cond2 ? s1.field2 = val2 : s1.field3 = val3;`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123680/new/

https://reviews.llvm.org/D123680



More information about the cfe-commits mailing list