[PATCH] D61552: [clang] Adapt ASTMatcher to explicit(bool) specifier

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 5 06:00:47 PDT 2019


aaron.ballman requested changes to this revision.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

You should also regenerate the documentation by running clang/docs/tools/dump_ast_matchers.py.



================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:1141
 
+/// Matches deduction guide declarations.
+///
----------------
Including implicit deduction guides? Might be worth clarifying that.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6168
 
-/// Matches constructor and conversion declarations that are marked with
-/// the explicit keyword.
+/// Matches constructor, conversion function and deduction guide declarations
+/// that have an explicit specifier if this explicit specifier is resolved to
----------------
conversion function and deduction -> conversion function, and deduction


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6197
 
+/// Matches constructor, conversion function and deduction guide declarations
+/// that have an explicit specifier.
----------------
Oxford comma here as well, please.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6219
+AST_POLYMORPHIC_MATCHER(
+    hasExplicitSpecifier,
+    AST_POLYMORPHIC_SUPPORTED_TYPES(CXXConstructorDecl, CXXConversionDecl,
----------------
I think this is a somewhat useful AST matcher, but I think we are going to need a way to match on the expression contained within the explicit specifier too, won't we? Perhaps a different approach is to make a matcher named `explicitSpecifier()` that allows traversing to the inner expression?


================
Comment at: clang/lib/ASTMatchers/Dynamic/Registry.cpp:163
   REGISTER_MATCHER(continueStmt);
   REGISTER_MATCHER(cudaKernelCallExpr);
   REGISTER_MATCHER(cxxBindTemporaryExpr);
----------------
This is missing the new `hasExplicitSpecifier()` matcher.


Repository:
  rC Clang

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

https://reviews.llvm.org/D61552





More information about the cfe-commits mailing list