[PATCH] D45476: [C++2a] Implement operator<=> CodeGen and ExprConstant
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 13 12:59:42 PDT 2018
EricWF added inline comments.
================
Comment at: include/clang/AST/ComparisonCategories.h:77-78
+ /// comparison category. For example 'std::strong_equality::equal'
+ const DeclRefExpr *getResultValue(ComparisonCategoryResult ValueKind) const {
+ const DeclRefExpr *DR = getResultValueUnsafe(ValueKind);
+ assert(DR &&
----------------
rsmith wrote:
> EricWF wrote:
> > rsmith wrote:
> > > This should deal in `DeclRefExpr*`s, not `NamedDecl*`s. We don't have an expression naming the comparison result value, and we shouldn't pretend we do.
> > I'm confused. This does deal in `DeclRefExpr*`s. I'm probably being daft. Could you clarify?
> Sorry, while editing this comment I managed to reverse it from what I meant. This should deal in NamedDecl* (or perhaps ValueDecl*) , not DeclRefExpr*.
OK, so I tried changing this to `VarDecl` but it made the `ExprConstant` and `GCExprAgg` implementations a lot harder, since we actually want to evaluate the result as a `DeclRefExpr` as we're not evaluating the actual `Decl`.
Since we don't want to be building dummy `DeclRefExpr`s during evaluation just to throw them away, I think it makes sense to eagerly build the results as `DeclRefExpr`s.
Does that make sense?
https://reviews.llvm.org/D45476
More information about the cfe-commits
mailing list