[PATCH] D54402: Extract method to allow re-use

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 12 15:52:24 PST 2018


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D54402#1296273, @steveire wrote:

> This is just a NFC change, which is normal to appear without tests. The consensus on IRC is that this is fine.


This NFC would likely be rejected were it not for your other patches because it would serve no purpose while adding complexity and overhead. I'm not certain why you feel so strongly about not merging this with other patches. We ask developers to do that for new features because it makes it trivial for us to know what to revert when a random bot goes red. That said, if you continue to feel strongly about this, I'll hold my nose.

LGTM with some formatting nits.



================
Comment at: lib/ASTMatchers/Dynamic/Registry.cpp:565
+template <typename Callable>
+void processAcceptableMatchers(ArrayRef<ArgKind> AcceptedTypes, Callable &&Func) {
 
----------------
80 col.


================
Comment at: lib/ASTMatchers/Dynamic/Registry.cpp:594-595
 
     if (!RetKinds.empty() && MaxSpecificity > 0) {
-      std::string Decl;
-      llvm::raw_string_ostream OS(Decl);
-
-      if (IsPolymorphic) {
-        OS << "Matcher<T> " << Name << "(Matcher<T>";
-      } else {
-        OS << "Matcher<" << RetKinds << "> " << Name << "(";
-        for (const std::vector<ArgKind> &Arg : ArgsKinds) {
-          if (&Arg != &ArgsKinds[0])
-            OS << ", ";
-
-          bool FirstArgKind = true;
-          std::set<ASTNodeKind> MatcherKinds;
-          // Two steps. First all non-matchers, then matchers only.
-          for (const ArgKind &AK : Arg) {
-            if (AK.getArgKind() == ArgKind::AK_Matcher) {
-              MatcherKinds.insert(AK.getMatcherKind());
-            } else {
-              if (!FirstArgKind) OS << "|";
-              FirstArgKind = false;
-              OS << AK.asString();
+      std::forward<Callable>(Func)(Name, Matcher, RetKinds, ArgsKinds, MaxSpecificity);
+    }
----------------
80 col and elide braces.


Repository:
  rC Clang

https://reviews.llvm.org/D54402





More information about the cfe-commits mailing list