File tree Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -792,6 +792,16 @@ class Expr : public ValueStmt {
792
792
return const_cast <Expr *>(this )->IgnoreImplicit ();
793
793
}
794
794
795
+ // / Skip past any implicit AST nodes which might surround this expression
796
+ // / until reaching a fixed point. Same as IgnoreImplicit, except that it
797
+ // / also skips over implicit calls to constructors and conversion functions.
798
+ // /
799
+ // / FIXME: Should IgnoreImplicit do this?
800
+ Expr *IgnoreImplicitAsWritten () LLVM_READONLY;
801
+ const Expr *IgnoreImplicitAsWritten () const {
802
+ return const_cast <Expr *>(this )->IgnoreImplicitAsWritten ();
803
+ }
804
+
795
805
// / Skip past any parentheses which might surround this expression until
796
806
// / reaching a fixed point. Skips:
797
807
// / * ParenExpr
Original file line number Diff line number Diff line change @@ -2893,6 +2893,13 @@ static Expr *IgnoreImplicitSingleStep(Expr *E) {
2893
2893
return E;
2894
2894
}
2895
2895
2896
+ static Expr *IgnoreImplicitAsWrittenSingleStep (Expr *E) {
2897
+ if (auto *ICE = dyn_cast<ImplicitCastExpr>(E))
2898
+ return ICE->getSubExprAsWritten ();
2899
+
2900
+ return IgnoreImplicitSingleStep (E);
2901
+ }
2902
+
2896
2903
static Expr *IgnoreParensSingleStep (Expr *E) {
2897
2904
if (auto *PE = dyn_cast<ParenExpr>(E))
2898
2905
return PE->getSubExpr ();
@@ -2972,6 +2979,10 @@ Expr *Expr::IgnoreImplicit() {
2972
2979
return IgnoreExprNodes (this , IgnoreImplicitSingleStep);
2973
2980
}
2974
2981
2982
+ Expr *Expr::IgnoreImplicitAsWritten () {
2983
+ return IgnoreExprNodes (this , IgnoreImplicitAsWrittenSingleStep);
2984
+ }
2985
+
2975
2986
Expr *Expr::IgnoreParens () {
2976
2987
return IgnoreExprNodes (this , IgnoreParensSingleStep);
2977
2988
}
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ CXXRewrittenBinaryOperator::getDecomposedForm() const {
107
107
return Result;
108
108
109
109
// Otherwise, we expect a <=> to now be on the LHS.
110
- E = Result.LHS ->IgnoreImplicit ();
110
+ E = Result.LHS ->IgnoreImplicitAsWritten ();
111
111
if (auto *BO = dyn_cast<BinaryOperator>(E)) {
112
112
assert (BO->getOpcode () == BO_Cmp);
113
113
Result.LHS = BO->getLHS ();
Original file line number Diff line number Diff line change @@ -361,6 +361,11 @@ void test_user_conv() {
361
361
}
362
362
}
363
363
364
+ struct X {
365
+ constexpr const Conv<int , -1 > operator <=>(X) { return {}; }
366
+ };
367
+ static_assert (X() < X());
368
+
364
369
} // namespace TestUserDefinedConvSeq
365
370
366
371
void test_array_conv () {
You can’t perform that action at this time.
0 commit comments