[PATCH] D94880: Add clang-query support for mapAnyOf

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 05:51:50 PST 2021


aaron.ballman added a comment.

I think there should be some documentation change for the new `with` functionality.



================
Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.h:398-407
+  bool isBuilderMatcher() const override { return false; }
+
+  std::unique_ptr<MatcherDescriptor>
+  buildMatcherCtor(SourceRange, ArrayRef<ParserValue>,
+                   Diagnostics *) const override {
+    return {};
+  }
----------------
Rather than repeat these degenerate definitions six times, should this just be the default implementation within `MatcherDescriptor` (so derived classes are not required to override them)? Alternatively, should we make a `NonBuilderMatcherDescriptor` class that holds the degenerate definition, and these derived classes can inherit from `NonBuilderMatcherDescriptor` instead?


================
Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.h:1094
+
+  void getArgKinds(ASTNodeKind ThisKind, unsigned ArgNo,
+                   std::vector<ArgKind> &ArgKinds) const override {
----------------



================
Comment at: clang/lib/ASTMatchers/Dynamic/Parser.cpp:373
+      Tokenizer->consumeNextToken(); // Consume the period.
+      const TokenInfo ChainCallToken = Tokenizer->consumeNextToken();
+      if (ChainCallToken.Kind == TokenInfo::TK_CodeCompletion) {
----------------



================
Comment at: clang/lib/ASTMatchers/Dynamic/Parser.cpp:449
 bool Parser::parseBindID(std::string &BindID) {
-  // Parse .bind("foo")
-  assert(Tokenizer->peekNextToken().Kind == TokenInfo::TK_Period);
-  Tokenizer->consumeNextToken(); // consume the period.
-  const TokenInfo BindToken = Tokenizer->consumeNextToken();
-  if (BindToken.Kind == TokenInfo::TK_CodeCompletion) {
-    addCompletion(BindToken, MatcherCompletion("bind(\"", "bind", 1));
-    return false;
-  }
-
+  // Parse argument to .bind("foo")
   const TokenInfo OpenToken = Tokenizer->consumeNextToken();
----------------



================
Comment at: clang/lib/ASTMatchers/Dynamic/Parser.cpp:606
+
+      const TokenInfo WithOpenToken = Tokenizer->consumeNextToken();
+
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94880/new/

https://reviews.llvm.org/D94880



More information about the cfe-commits mailing list