njames93 added a comment.

Thanks for looking at this, its been on my todo list for long time.
Regarding the hasGrandparent idea, that could be recreated with 
`hasParent(expr(hasParent(cxxRewrittenBinaryOperator())))`
Though looking at the (trimmed) AST I'm not sure that's enough. Appears to have 
4 levels of parents before reaching the cxxRewrittenBinaryOperator

  -CXXRewrittenBinaryOperator <col:13, col:18> 'bool'
    -CXXOperatorCallExpr <col:13, col:16> 'bool' '<' adl
     |-ImplicitCastExpr <col:16> 'bool (*)(std::strong_ordering, 
__cmp_cat::__unspec) noexcept' <FunctionToPointerDecay>
     |-CXXOperatorCallExpr <col:13, col:18> 
'std::strong_ordering':'std::strong_ordering' '<=>'
      -ImplicitCastExpr <col:16> 
'__cmp_cat::__unspec':'std::__cmp_cat::__unspec' <ConstructorConversion>
        -CXXConstructExpr <col:16> 
'__cmp_cat::__unspec':'std::__cmp_cat::__unspec' 'void 
(std::__cmp_cat::__unspec *) noexcept'
          -ImplicitCastExpr <col:16> 'std::__cmp_cat::__unspec *' 
<NullToPointer> // Cast we care about
            -IntegerLiteral <col:16> 'int' 0



================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/modernize-use-nullptr-cxx20.cpp:3-4
+
+// Not all systems have #include <compare> to define std::std_ordering
+// required by operator<=>, so recreate minimal version for tests below.
+namespace std {
----------------
We don't compile against a std library for tests so this comment is redundant.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95714

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to