[PATCH] D45476: [C++2a] Implement operator<=> CodeGen and ExprConstant

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 5 04:24:30 PDT 2018


EricWF added inline comments.


================
Comment at: lib/AST/ExprConstant.cpp:8829
+  return EvaluateComparisonBinaryOperator(Info, E, OnSuccess, [&]() {
+    return ExprEvaluatorBaseTy::VisitBinaryOperator(E);
+  });
----------------
rsmith wrote:
> It'd be clearer to call `VisitBinCmp` rather than `VisitBinaryOperator`.
@rsmith: OK, so I'm confused about this. Originally I had an `llvm_unreachable` that the continuation was never reached, but you suggested it was. I'm not sure how. Could you provide an example?

The precondition of calling `VisitBinCmp` is that we have a call to a builtin operator. For `<=>`,  where the composite type is either an arithmetic type, pointer type, or member pointer type (which includes enum types after conversions),  *All* of these cases should be handled before reaching the function.

Is there a control flow path I'm missing? 


https://reviews.llvm.org/D45476





More information about the cfe-commits mailing list