[PATCH] D54403: Add new API for returning matching matchers

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 11 15:32:19 PST 2018


aaron.ballman added inline comments.


================
Comment at: lib/ASTMatchers/Dynamic/Registry.cpp:604-605
+
+  std::vector<ArgKind> AcceptedTypes;
+  AcceptedTypes.push_back(StaticType);
+
----------------
`std::vector<ArgKind> AcceptedTypes{StaticType};` instead?


================
Comment at: lib/ASTMatchers/Dynamic/Registry.cpp:608-611
+      AcceptedTypes, [&Result](StringRef Name, const MatcherDescriptor &Matcher,
+                               std::set<ASTNodeKind> &RetKinds,
+                               std::vector<std::vector<ArgKind>> ArgsKinds,
+                               unsigned MaxSpecificity) {
----------------
Elide the identifiers for arguments that are not named in the lambda.


================
Comment at: unittests/ASTMatchers/Dynamic/RegistryTest.cpp:563
+
+  auto Contains = [](std::vector<MatchingMatcher> const &C, StringRef Name) {
+    return std::find_if(C.begin(), C.end(), [Name](const MatchingMatcher &M) {
----------------
Move the `const` to the other side of the declaration.


================
Comment at: unittests/ASTMatchers/Dynamic/RegistryTest.cpp:564
+  auto Contains = [](std::vector<MatchingMatcher> const &C, StringRef Name) {
+    return std::find_if(C.begin(), C.end(), [Name](const MatchingMatcher &M) {
+             return M.MatcherString == Name;
----------------
`std::find_if(C.begin(), C.end(), ...)` -> `llvm::find_if(C, ...)`


Repository:
  rC Clang

https://reviews.llvm.org/D54403





More information about the cfe-commits mailing list