[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-28 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo closed this revision. oontvoo added a comment. Thanks, all! Committed https://github.com/llvm/llvm-project/commit/51401a676c036f2bd4e6b4b38f3538615799de40 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-28 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo updated this revision to Diff 267008. oontvoo added a comment. Move matcher to near forEachArgumentWithParam Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/ https://reviews.llvm.org/D80603 Files:

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-28 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo added a comment. In D80603#2061131 , @aaron.ballman wrote: > In D80603#2059122 , @gribozavr2 > wrote: > > > In D80603#2058019 , @aaron.ballman > > wrote: > > > >

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-28 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo updated this revision to Diff 266999. oontvoo added a comment. Updated Registry Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/ https://reviews.llvm.org/D80603 Files: clang/docs/LibASTMatchersReference.html

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-28 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added a comment. > Also, you need to update Registry.cpp to add this to the list of dynamic > matchers. Good point. @oontvoo Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/ https://reviews.llvm.org/D80603

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-28 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added a comment. > Is there a reason we want to support blocks but not lambdas? Lambdas are supported (see tests). Lambdas generate classes with regular function decls, so there's no surprise there. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D80603#2059122 , @gribozavr2 wrote: > In D80603#2058019 , @aaron.ballman > wrote: > > > I'm sorry if I'm being dense, but `hasParameter` traverses to the > > `ParmVarDecl`, so

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-28 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo updated this revision to Diff 266887. oontvoo marked 2 inline comments as done. oontvoo added a comment. Change tests to us no/matchesObjC Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/ https://reviews.llvm.org/D80603 Files:

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added inline comments. Comment at: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp:2672 +TEST(IsAtPosition, BlockDecl) { + // FIXME: Needs to enable block-support (ie., -fblocks) + if (true) Please use `matchesObjC` / `notMatchesObjC`.

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added a comment. In D80603#2058019 , @aaron.ballman wrote: > I'm sorry if I'm being dense, but `hasParameter` traverses to the > `ParmVarDecl`, so I'm not certain I understand why this new matcher is needed > as a public matcher. It seems

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo updated this revision to Diff 266735. oontvoo added a comment. More tests for Block Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/ https://reviews.llvm.org/D80603 Files: clang/docs/LibASTMatchersReference.html

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo updated this revision to Diff 266714. oontvoo added a comment. use helper for examining the node instead of nested matchers Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/ https://reviews.llvm.org/D80603 Files:

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo added a comment. In D80603#2058019 , @aaron.ballman wrote: > In D80603#2057970 , @oontvoo wrote: > > > In D80603#2057014 , @aaron.ballman > > wrote: > > > > > Does

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo updated this revision to Diff 266642. oontvoo added a comment. Remove unrelated doc generated by the script Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/ https://reviews.llvm.org/D80603 Files:

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D80603#2057970 , @oontvoo wrote: > In D80603#2057014 , @aaron.ballman > wrote: > > > Does the `hasParameter()` matcher not already do this? > > > Yes, it does. But we'd like it to

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo updated this revision to Diff 266615. oontvoo marked 7 inline comments as done. oontvoo added a comment. - Added docs - Make it work with {block,objcMethod}Decl too. More tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo added a comment. In D80603#2057014 , @aaron.ballman wrote: > Does the `hasParameter()` matcher not already do this? Yes, it does. But we'd like it to be able to match on the parmVarDecl(). Comment at:

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel added inline comments. Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7018 +AST_MATCHER_P(clang::ParmVarDecl, isAtPosition, unsigned, N) { + return parmVarDecl(hasAncestor(functionDecl( + hasParameter(N,

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a reviewer: aaron.ballman. aaron.ballman added a comment. Does the `hasParameter()` matcher not already do this? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80603/new/ https://reviews.llvm.org/D80603

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-27 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added a comment. Please run clang/docs/tools/dump_ast_matchers.py to update the docs. Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7022 + .matches(Node, Finder, Builder); +} + Could you move it closer to other parameter-related

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-26 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo added a comment. P.S: Please ignore the child revision ... accidentally committed it to the wrong branch. I've fixed the git branches locally but can't figure out how to tell phabricator ... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D80603: add isAtPosition narrowing matcher for parmVarDecl

2020-05-26 Thread Vy Nguyen via Phabricator via cfe-commits
oontvoo created this revision. Herald added subscribers: cfe-commits, danielkiss, kristof.beyls. Herald added a project: clang. oontvoo added reviewers: gribozavr, ymandel. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D80603 Files: