From c2b22c57fc1394f2566d20369ae29877eb7df1a1 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Mon, 22 Jun 2020 10:56:04 +0100 Subject: [PATCH] Fixed ASTMatchers registry and regen ast docs --- clang/docs/LibASTMatchersReference.html | 48 +++++++++++++++------------ clang/include/clang/ASTMatchers/ASTMatchers.h | 2 +- clang/lib/ASTMatchers/Dynamic/Registry.cpp | 5 ++- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index bb5e4984fcd..ae90ba047df 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -1226,6 +1226,11 @@ Example matches std::string() +Matcher<Stmt>fixedPointLiteralMatcher<FixedPointLiteral>... +
Matches fixed point literals
+
+ + Matcher<Stmt>floatLiteralMatcher<FloatingLiteral>...
Matches float literals of all sizes / encodings, e.g.
 1.0, 1.0f, 1.0L and 1e10.
@@ -4016,6 +4021,23 @@ is equivalent to parmVarDecl(hasDefaultArgument()).
 
+Matcher<ParmVarDecl>isAtPositionunsigned N +
Matches the ParmVarDecl nodes that are at the N'th position in the parameter
+list. The parameter list could be that of either a block, function, or
+objc-method.
+
+
+Given
+
+void f(int a, int b, int c) {
+}
+
+``parmVarDecl(isAtPosition(0))`` matches ``int a``.
+
+``parmVarDecl(isAtPosition(1))`` matches ``int b``.
+
+ + Matcher<QualType>asStringstd::string Name
Matches if the matched type is represented by the given string.
 
@@ -4755,23 +4777,6 @@ cxxRecordDecl(hasName("::X"), isTemplateInstantiation())
 Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl>
 
- -Matcher<clang::ParmVarDecl>isAtPositionunsigned N -
Matches the ParmVarDecl nodes that are at the N'th position in the parameter
-list. The parameter list could be that of either a block, function, or
-objc-method.
-
-
-Given
-
-void f(int a, int b, int c) {
-}
-
-``parmVarDecl(isAtPosition(0))`` matches ``int a``.
-
-``parmVarDecl(isAtPosition(1))`` matches ``int b``.
-
- @@ -5632,13 +5637,14 @@ cxxNewExpr(hasPlacementArg(1, integerLiteral(equals(16)))) Matcher<CXXRecordDecl>hasAnyBaseMatcher<CXXBaseSpecifier> BaseSpecMatcher
Matches C++ classes that have a direct or indirect base matching BaseSpecMatcher.
 
-Example matches DirectlyDerived, IndirectlyDerived (BaseSpecMatcher ==
-hasType(cxxRecordDecl(hasName("SpecialBase")))) class Foo;
+Example:
+matcher hasAnyBase(hasType(cxxRecordDecl(hasName("SpecialBase")))))
+  class Foo;
   class Bar : Foo {};
   class Baz : Bar {};
   class SpecialBase;
-  class DirectlyDerived : SpecialBase {};  // directly derived
-  class IndirectlyDerived : DirectlyDerived {};  // indirectly derived
+  class Proxy : SpecialBase {};  // matches Proxy
+  class IndirectlyDerived : Proxy {};  //matches IndirectlyDerived
 
 FIXME: Refactor this and isDerivedFrom to reuse implementation.
 
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 6dbcc01442e..4d5e4230302 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -4323,7 +4323,7 @@ AST_POLYMORPHIC_MATCHER_P2(forEachArgumentWithParam, /// ``parmVarDecl(isAtPosition(0))`` matches ``int a``. /// /// ``parmVarDecl(isAtPosition(1))`` matches ``int b``. -AST_MATCHER_P(clang::ParmVarDecl, isAtPosition, unsigned, N) { +AST_MATCHER_P(ParmVarDecl, isAtPosition, unsigned, N) { const clang::DeclContext *Context = Node.getParentFunctionOrMethod(); if (const auto *Decl = dyn_cast_or_null(Context)) diff --git a/clang/lib/ASTMatchers/Dynamic/Registry.cpp b/clang/lib/ASTMatchers/Dynamic/Registry.cpp index 950a56f7955..c7f151f6135 100644 --- a/clang/lib/ASTMatchers/Dynamic/Registry.cpp +++ b/clang/lib/ASTMatchers/Dynamic/Registry.cpp @@ -151,6 +151,7 @@ RegistryMaps::RegistryMaps() { REGISTER_MATCHER(characterLiteral); REGISTER_MATCHER(chooseExpr); REGISTER_MATCHER(classTemplateDecl); + REGISTER_MATCHER(classTemplatePartialSpecializationDecl); REGISTER_MATCHER(classTemplateSpecializationDecl); REGISTER_MATCHER(complexType); REGISTER_MATCHER(compoundLiteralExpr); @@ -219,7 +220,6 @@ RegistryMaps::RegistryMaps() { REGISTER_MATCHER(floatLiteral); REGISTER_MATCHER(forEach); REGISTER_MATCHER(forEachArgumentWithParam); - REGISTER_MATCHER(isAtPosition); REGISTER_MATCHER(forEachConstructorInitializer); REGISTER_MATCHER(forEachDescendant); REGISTER_MATCHER(forEachOverridden); @@ -353,6 +353,7 @@ RegistryMaps::RegistryMaps() { REGISTER_MATCHER(isArray); REGISTER_MATCHER(isArrow); REGISTER_MATCHER(isAssignmentOperator); + REGISTER_MATCHER(isAtPosition); REGISTER_MATCHER(isBaseInitializer); REGISTER_MATCHER(isBitField); REGISTER_MATCHER(isCatchAll); @@ -370,7 +371,9 @@ RegistryMaps::RegistryMaps() { REGISTER_MATCHER(isDefinition); REGISTER_MATCHER(isDelegatingConstructor); REGISTER_MATCHER(isDeleted); + REGISTER_MATCHER(isEnum); REGISTER_MATCHER(isExceptionVariable); + REGISTER_MATCHER(isExpandedFromMacro); REGISTER_MATCHER(isExpansionInFileMatching); REGISTER_MATCHER(isExpansionInMainFile); REGISTER_MATCHER(isExpansionInSystemHeader); -- 2.11.0