[PATCH] D95739: [ASTMatchers] Add matchers for decomposition decls
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 1 08:55:50 PST 2021
aaron.ballman added a comment.
Thanks for this! It generally looks good, aside from some minor nits. Btw, it looks like the HTML documentation wasn't regenerated for the patch.
================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7392
+/// Matches the DecompositionDecl the binding belongs to.
+AST_MATCHER_P(BindingDecl, forDecomposition, internal::Matcher<ValueDecl>,
----------------
Can you add code examples to all of the new functionality?
================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:7395-7397
+ if (!Node.getDecomposedDecl())
+ return false;
+ return InnerMatcher.matches(*Node.getDecomposedDecl(), Finder, Builder);
----------------
================
Comment at: clang/lib/ASTMatchers/Dynamic/Registry.cpp:274
REGISTER_MATCHER(hasBase);
+ REGISTER_MATCHER(hasAnyBinding);
+ REGISTER_MATCHER(hasBinding);
----------------
This should be kept in alphabetical order.
================
Comment at: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp:2142-2144
+ EXPECT_TRUE(matchesConditionally(
+ Code, decompositionDecl(hasBinding(0, bindingDecl(hasName("f")))), true,
+ {"-std=c++17"}));
----------------
Can you add some test coverage for the invalid cases as well, like asking for an out-of-range binding?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95739/new/
https://reviews.llvm.org/D95739
More information about the cfe-commits
mailing list