[PATCH] D134801: [clang][Interp] Implement ConditionalOperators

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 29 12:30:00 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:90
   bool VisitOpaqueValueExpr(const OpaqueValueExpr *E);
+  bool VisitConditionalOperator(const ConditionalOperator *E);
 
----------------
Do we want to handle `BinaryConditionalOperator` at the same time? (IIRC, you should be able to use `AbstractConditionalOperator` here and the logic is handled for you automagically for both constructs.) e.g.,
```
foo() ? 12 : bar  // C conditional operator, has the value 12 if foo() is nonzero and bar otherwise
foo() ? : bar // GNU "missing middle" conditional operator, has the value of foo() if nonzero and bar otherwise
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134801



More information about the cfe-commits mailing list