[PATCH] D80623: WIP: Add an API to simplify setting TraversalKind in clang-tidy matchers

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 10:00:02 PDT 2020


steveire marked an inline comment as done.
steveire added a comment.

Reviving this so it can be used to port `clang-tidy` checks to `IgnoreUnlessSpelledInSource`.



================
Comment at: clang/include/clang/ASTMatchers/ASTMatchFinder.h:118
+    /// behavior of clang-tidy.
+    virtual llvm::Optional<ast_type_traits::TraversalKind>
+    getCheckTraversalKind() const;
----------------
sammccall wrote:
> I don't really get why this would be optional.
> A check's implementation isn't really going to be robust to "whatever the default is", it's going to be tested against one or the other.
> So None isn't really a sensible return value - can't the base class simply return the actual default?
ASTMatchFinder doesn't know the ASTContext, so it can't access the default. That's why I made it an optional.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80623



More information about the cfe-commits mailing list