[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2020-05-28 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:286 + + virtual llvm::Optional TraversalKind() const { +return {}; aaron.ballman wrote: > `traversalKind()` Stephen -- What was the resolution on this comment? I came

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-12-06 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment. I tried using DenseMap, but couldn't make it compile. I stuck with std::map for now. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61837/new/ https://reviews.llvm.org/D61837

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-12-06 Thread Stephen Kelly via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG0a717d5b5d31: Make it possible control matcher traversal kind with ASTContext (authored by stephenkelly). Changed prior to commit: https://reviews.llvm.org/D61837?vs=230678&id=232661#toc Repository:

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-11-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM with a few minor nits. Comment at: clang/include/clang/AST/ASTContext.h:3009 class ParentMap; - std::unique_ptr Parents; + std::map> Parents; --

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-11-22 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 230678. steveire added a comment. Rebase and update Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61837/new/ https://reviews.llvm.org/D61837 Files: clang/include/clang/AST/ASTContext.h clang/include/clang

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-17 Thread Stephen Kelly via Phabricator via cfe-commits
steveire marked an inline comment as done. steveire added inline comments. Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:240 + + assert(RestrictKind.isBaseOf(NodeKind)); + if (Implementation->dynMatches(N, Finder, Builder)) { aaron.ballman wrote: > stevei

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-17 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: lib/AST/ASTContext.cpp:120 +ASTContext::TraverseIgnored(const ast_type_traits::DynTypedNode &N) { + if (auto E = N.get()) { +return ast_type_traits::DynTypedNode::create(*TraverseIgnored(E)); aaron.ballman wro

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-17 Thread Stephen Kelly via Phabricator via cfe-commits
steveire marked an inline comment as done. steveire added inline comments. Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:240 + + assert(RestrictKind.isBaseOf(NodeKind)); + if (Implementation->dynMatches(N, Finder, Builder)) { aaron.ballman wrote: > Add an

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:718 +template +internal::Matcher traverse(ast_type_traits::TraversalKind TK, + const internal::Matcher &InnerMatcher) { steveire wrote: > aaron.

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-16 Thread Stephen Kelly via Phabricator via cfe-commits
steveire marked 2 inline comments as done. steveire added inline comments. Comment at: include/clang/ASTMatchers/ASTMatchers.h:718 +template +internal::Matcher traverse(ast_type_traits::TraversalKind TK, + const internal::Matcher &InnerMatcher) { ---

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-16 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 199884. steveire added a comment. Update Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61837/new/ https://reviews.llvm.org/D61837 Files: include/clang/AST/ASTContext.h include/clang/AST/ASTNodeTraverser.h include/clan

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: include/clang/AST/ASTContext.h:562-563 public: + ast_type_traits::TraversalKind GetTraversalKind() const { return Traversal; } + void SetTraversalKind(ast_type_traits::TraversalKind TK) { Traversal = TK; } + ste

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-16 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added inline comments. Comment at: include/clang/AST/ASTContext.h:562-563 public: + ast_type_traits::TraversalKind GetTraversalKind() const { return Traversal; } + void SetTraversalKind(ast_type_traits::TraversalKind TK) { Traversal = TK; } + aaron.ba

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-16 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 199875. steveire marked 10 inline comments as done. steveire added a comment. Update Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61837/new/ https://reviews.llvm.org/D61837 Files: include/clang/AST/ASTContext.h include

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. Thanks for this -- it looks like really interesting functionality! I've mostly found nits thus far, but did have a question about clang-query support for it. Comment at: include/clang/AST/ASTContext.h:562-563 public: + ast_type_traits::Traversa

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-12 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 199185. steveire added a comment. Format Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61837/new/ https://reviews.llvm.org/D61837 Files: include/clang/AST/ASTContext.h include/clang/AST/ASTNodeTraverser.h include/clan

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-12 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 199181. steveire added a comment. Format Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61837/new/ https://reviews.llvm.org/D61837 Files: include/clang/AST/ASTContext.h include/clang/AST/ASTNodeTraverser.h include/clan

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-12 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment. @klimek This includes a test for the memoization case you were interested in at EuroLLVM. In this iteration of the API, the traversal kind is changed by using a new `traverse` matcher, which gives the user control over whether invisible/implicit nodes are skipped or n

[PATCH] D61837: Make it possible control matcher traversal kind with ASTContext

2019-05-12 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision. steveire added reviewers: klimek, aaron.ballman. Herald added a project: clang. Herald added a subscriber: cfe-commits. This will eventually allow traversal of an AST while ignoring invisible AST nodes. Currently it depends on the available enum values for Traversa