clang 20.0.0git
|
Namespaces | |
namespace | dynamic |
namespace | internal |
namespace | libc_func_matchers |
Classes | |
class | BoundNodes |
Maps string IDs to AST nodes matched by parts of a matcher. More... | |
class | MatchDescendantVisitor |
class | MatchFinder |
A class to allow finding matches over the Clang AST. More... | |
Typedefs | |
template<typename NodeType > | |
using | AstTypeMatcher = internal::VariadicDynCastAllOfMatcher< Type, NodeType > |
using | DeclarationMatcher = internal::Matcher< Decl > |
Types of matchers for the top-level classes in the AST class hierarchy. | |
using | StatementMatcher = internal::Matcher< Stmt > |
using | TypeMatcher = internal::Matcher< QualType > |
using | TypeLocMatcher = internal::Matcher< TypeLoc > |
using | NestedNameSpecifierMatcher = internal::Matcher< NestedNameSpecifier > |
using | NestedNameSpecifierLocMatcher = internal::Matcher< NestedNameSpecifierLoc > |
using | CXXBaseSpecifierMatcher = internal::Matcher< CXXBaseSpecifier > |
using | CXXCtorInitializerMatcher = internal::Matcher< CXXCtorInitializer > |
using | TemplateArgumentMatcher = internal::Matcher< TemplateArgument > |
using | TemplateArgumentLocMatcher = internal::Matcher< TemplateArgumentLoc > |
using | LambdaCaptureMatcher = internal::Matcher< LambdaCapture > |
using | AttrMatcher = internal::Matcher< Attr > |
Enumerations | |
enum class | GtestCmp { Eq , Ne , Ge , Gt , Le , Lt } |
Gtest's comparison operations. More... | |
enum class | MockArgs { None , Some } |
This enum indicates whether the mock method in the matched ON_CALL or EXPECT_CALL macro has arguments. More... | |
Functions | |
internal::TrueMatcher | anything () |
Matches any node. | |
AST_POLYMORPHIC_MATCHER (isExpansionInMainFile, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc)) | |
Matches AST nodes that were expanded within the main-file. | |
AST_POLYMORPHIC_MATCHER (isExpansionInSystemHeader, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc)) | |
Matches AST nodes that were expanded within system-header-files. | |
AST_POLYMORPHIC_MATCHER_REGEX (isExpansionInFileMatching, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), RegExp) | |
Matches AST nodes that were expanded within files whose name is partially matching a given regex. | |
AST_POLYMORPHIC_MATCHER_P (isExpandedFromMacro, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), std::string, MacroName) | |
Matches statements that are (transitively) expanded from the named macro. | |
AST_POLYMORPHIC_MATCHER (isPublic, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, CXXBaseSpecifier)) | |
Matches public C++ declarations and C++ base specifers that specify public inheritance. | |
AST_POLYMORPHIC_MATCHER (isProtected, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, CXXBaseSpecifier)) | |
Matches protected C++ declarations and C++ base specifers that specify protected inheritance. | |
AST_POLYMORPHIC_MATCHER (isPrivate, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, CXXBaseSpecifier)) | |
Matches private C++ declarations and C++ base specifers that specify private inheritance. | |
AST_MATCHER (FieldDecl, isBitField) | |
Matches non-static data members that are bit-fields. | |
AST_MATCHER_P (FieldDecl, hasBitWidth, unsigned, Width) | |
Matches non-static data members that are bit-fields of the specified bit width. | |
AST_MATCHER_P (FieldDecl, hasInClassInitializer, internal::Matcher< Expr >, InnerMatcher) | |
Matches non-static data members that have an in-class initializer. | |
AST_MATCHER (FunctionDecl, isMain) | |
Determines whether the function is "main", which is the entry point into an executable program. | |
AST_MATCHER_P (ClassTemplateSpecializationDecl, hasSpecializedTemplate, internal::Matcher< ClassTemplateDecl >, InnerMatcher) | |
Matches the specialized template of a specialization declaration. | |
AST_POLYMORPHIC_MATCHER (isImplicit, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Attr, LambdaCapture)) | |
Matches an entity that has been implicitly added by the compiler (e.g. | |
AST_POLYMORPHIC_MATCHER_P (hasAnyTemplateArgument, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, TemplateSpecializationType), internal::Matcher< TemplateArgument >, InnerMatcher) | |
Matches templateSpecializationTypes, class template specializations, variable template specializations, and function template specializations that have at least one TemplateArgument matching the given InnerMatcher. | |
template<typename T > | |
internal::Matcher< T > | traverse (TraversalKind TK, const internal::Matcher< T > &InnerMatcher) |
Causes all nested matchers to be matched with the specified traversal kind. | |
template<typename T > | |
internal::BindableMatcher< T > | traverse (TraversalKind TK, const internal::BindableMatcher< T > &InnerMatcher) |
template<typename... T> | |
internal::TraversalWrapper< internal::VariadicOperatorMatcher< T... > > | traverse (TraversalKind TK, const internal::VariadicOperatorMatcher< T... > &InnerMatcher) |
template<template< typename ToArg, typename FromArg > class ArgumentAdapterT, typename T , typename ToTypes > | |
internal::TraversalWrapper< internal::ArgumentAdaptingMatcherFuncAdaptor< ArgumentAdapterT, T, ToTypes > > | traverse (TraversalKind TK, const internal::ArgumentAdaptingMatcherFuncAdaptor< ArgumentAdapterT, T, ToTypes > &InnerMatcher) |
template<template< typename T, typename... P > class MatcherT, typename... P, typename ReturnTypesF > | |
internal::TraversalWrapper< internal::PolymorphicMatcher< MatcherT, ReturnTypesF, P... > > | traverse (TraversalKind TK, const internal::PolymorphicMatcher< MatcherT, ReturnTypesF, P... > &InnerMatcher) |
template<typename... T> | |
internal::Matcher< typename internal::GetClade< T... >::Type > | traverse (TraversalKind TK, const internal::MapAnyOfHelper< T... > &InnerMatcher) |
AST_MATCHER_P (Expr, ignoringImplicit, internal::Matcher< Expr >, InnerMatcher) | |
Matches expressions that match InnerMatcher after any implicit AST nodes are stripped off. | |
AST_MATCHER_P (Expr, ignoringImpCasts, internal::Matcher< Expr >, InnerMatcher) | |
Matches expressions that match InnerMatcher after any implicit casts are stripped off. | |
AST_MATCHER_P (Expr, ignoringParenCasts, internal::Matcher< Expr >, InnerMatcher) | |
Matches expressions that match InnerMatcher after parentheses and casts are stripped off. | |
AST_MATCHER_P (Expr, ignoringParenImpCasts, internal::Matcher< Expr >, InnerMatcher) | |
Matches expressions that match InnerMatcher after implicit casts and parentheses are stripped off. | |
AST_MATCHER_P_OVERLOAD (QualType, ignoringParens, internal::Matcher< QualType >, InnerMatcher, 0) | |
Matches types that match InnerMatcher after any parens are stripped. | |
AST_MATCHER_P_OVERLOAD (Expr, ignoringParens, internal::Matcher< Expr >, InnerMatcher, 1) | |
Overload ignoringParens for Expr . | |
AST_MATCHER (Expr, isInstantiationDependent) | |
Matches expressions that are instantiation-dependent even if it is neither type- nor value-dependent. | |
AST_MATCHER (Expr, isTypeDependent) | |
Matches expressions that are type-dependent because the template type is not yet instantiated. | |
AST_MATCHER (Expr, isValueDependent) | |
Matches expression that are value-dependent because they contain a non-type template parameter. | |
AST_POLYMORPHIC_MATCHER_P2 (hasTemplateArgument, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, TemplateSpecializationType), unsigned, N, internal::Matcher< TemplateArgument >, InnerMatcher) | |
Matches templateSpecializationType, class template specializations, variable template specializations, and function template specializations where the n'th TemplateArgument matches the given InnerMatcher. | |
AST_POLYMORPHIC_MATCHER_P (templateArgumentCountIs, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, TemplateSpecializationType), unsigned, N) | |
Matches if the number of template arguments equals N . | |
AST_MATCHER_P (TemplateArgument, refersToType, internal::Matcher< QualType >, InnerMatcher) | |
Matches a TemplateArgument that refers to a certain type. | |
AST_MATCHER_P (TemplateArgument, refersToTemplate, internal::Matcher< TemplateName >, InnerMatcher) | |
Matches a TemplateArgument that refers to a certain template. | |
AST_MATCHER_P (TemplateArgument, refersToDeclaration, internal::Matcher< Decl >, InnerMatcher) | |
Matches a canonical TemplateArgument that refers to a certain declaration. | |
AST_MATCHER_P (TemplateArgument, isExpr, internal::Matcher< Expr >, InnerMatcher) | |
Matches a sugar TemplateArgument that refers to a certain expression. | |
AST_MATCHER (TemplateArgument, isIntegral) | |
Matches a TemplateArgument that is an integral value. | |
AST_MATCHER_P (TemplateArgument, refersToIntegralType, internal::Matcher< QualType >, InnerMatcher) | |
Matches a TemplateArgument that refers to an integral type. | |
AST_MATCHER_P (TemplateArgument, equalsIntegralValue, std::string, Value) | |
Matches a TemplateArgument of integral type with a given value. | |
AST_MATCHER (CallExpr, usesADL) | |
Matches call expressions which were resolved using ADL. | |
AST_MATCHER_P (InitListExpr, hasSyntacticForm, internal::Matcher< Expr >, InnerMatcher) | |
Matches the syntactic form of init list expressions (if expression have it). | |
AST_MATCHER_P (ForStmt, hasIncrement, internal::Matcher< Stmt >, InnerMatcher) | |
Matches the increment statement of a for loop. | |
AST_MATCHER_P (ForStmt, hasLoopInit, internal::Matcher< Stmt >, InnerMatcher) | |
Matches the initialization statement of a for loop. | |
AST_MATCHER_P (CXXForRangeStmt, hasLoopVariable, internal::Matcher< VarDecl >, InnerMatcher) | |
Matches the initialization statement of a for loop. | |
AST_MATCHER_P (CXXForRangeStmt, hasRangeInit, internal::Matcher< Expr >, InnerMatcher) | |
Matches the range initialization statement of a for loop. | |
AST_MATCHER_P (DesignatedInitExpr, designatorCountIs, unsigned, N) | |
Matches designated initializer expressions that contain a specific number of designators. | |
template<typename T , typename... U> | |
auto | mapAnyOf (internal::VariadicDynCastAllOfMatcher< T, U > const &...) |
Matches any of the NodeMatchers with InnerMatchers nested within. | |
AST_MATCHER_P (UnaryExprOrTypeTraitExpr, hasArgumentOfType, internal::Matcher< QualType >, InnerMatcher) | |
Matches unary expressions that have a specific type of argument. | |
AST_MATCHER_P (UnaryExprOrTypeTraitExpr, ofKind, UnaryExprOrTypeTrait, Kind) | |
Matches unary expressions of a certain kind. | |
internal::BindableMatcher< Stmt > | alignOfExpr (const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher) |
Same as unaryExprOrTypeTraitExpr, but only matching alignof. | |
internal::BindableMatcher< Stmt > | sizeOfExpr (const internal::Matcher< UnaryExprOrTypeTraitExpr > &InnerMatcher) |
Same as unaryExprOrTypeTraitExpr, but only matching sizeof. | |
internal::Matcher< NamedDecl > | hasName (StringRef Name) |
Matches NamedDecl nodes that have the specified name. | |
AST_MATCHER_REGEX (NamedDecl, matchesName, RegExp) | |
Matches NamedDecl nodes whose fully qualified names contain a substring matched by the given RegExp. | |
internal::PolymorphicMatcher< internal::HasOverloadedOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl), std::vector< std::string > > | hasOverloadedOperatorName (StringRef Name) |
Matches overloaded operator names. | |
AST_MATCHER_P (CXXDependentScopeMemberExpr, hasMemberName, std::string, N) | |
Matches template-dependent, but known, member names. | |
AST_MATCHER_P (CXXDependentScopeMemberExpr, memberHasSameNameAsBoundNode, std::string, BindingID) | |
Matches template-dependent, but known, member names against an already-bound node. | |
AST_POLYMORPHIC_MATCHER_P (isDerivedFrom, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl), internal::Matcher< NamedDecl >, Base) | |
Matches C++ classes that are directly or indirectly derived from a class matching Base , or Objective-C classes that directly or indirectly subclass a class matching Base . | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (isDerivedFrom, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl), std::string, BaseName, 1) | |
Overloaded method as shortcut for isDerivedFrom(hasName(...)) . | |
AST_MATCHER_P (CXXRecordDecl, hasAnyBase, internal::Matcher< CXXBaseSpecifier >, BaseSpecMatcher) | |
Matches C++ classes that have a direct or indirect base matching BaseSpecMatcher . | |
AST_MATCHER_P (CXXRecordDecl, hasDirectBase, internal::Matcher< CXXBaseSpecifier >, BaseSpecMatcher) | |
Matches C++ classes that have a direct base matching BaseSpecMatcher . | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (isSameOrDerivedFrom, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl), internal::Matcher< NamedDecl >, Base, 0) | |
Similar to isDerivedFrom() , but also matches classes that directly match Base . | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (isSameOrDerivedFrom, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl), std::string, BaseName, 1) | |
Overloaded method as shortcut for isSameOrDerivedFrom(hasName(...)) . | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (isDirectlyDerivedFrom, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl), internal::Matcher< NamedDecl >, Base, 0) | |
Matches C++ or Objective-C classes that are directly derived from a class matching Base . | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (isDirectlyDerivedFrom, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl), std::string, BaseName, 1) | |
Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)) . | |
AST_MATCHER_P (CXXRecordDecl, hasMethod, internal::Matcher< CXXMethodDecl >, InnerMatcher) | |
Matches the first method of a class or struct that satisfies InnerMatcher . | |
AST_MATCHER (CXXRecordDecl, isLambda) | |
Matches the generated class of lambda expressions. | |
template<typename T > | |
internal::Matcher< T > | findAll (const internal::Matcher< T > &Matcher) |
Matches if the node or any descendant matches. | |
internal::PolymorphicMatcher< internal::HasDeclarationMatcher, void(internal::HasDeclarationSupportedTypes), internal::Matcher< Decl > > | hasDeclaration (const internal::Matcher< Decl > &InnerMatcher) |
Matches a node if the declaration associated with that node matches the given matcher. | |
AST_MATCHER_P (NamedDecl, hasUnderlyingDecl, internal::Matcher< NamedDecl >, InnerMatcher) | |
Matches a NamedDecl whose underlying declaration matches the given matcher. | |
AST_MATCHER_P (CXXMemberCallExpr, on, internal::Matcher< Expr >, InnerMatcher) | |
Matches on the implicit object argument of a member call expression, after stripping off any parentheses or implicit casts. | |
AST_MATCHER_P (ObjCMessageExpr, hasReceiverType, internal::Matcher< QualType >, InnerMatcher) | |
Matches on the receiver of an ObjectiveC Message expression. | |
AST_MATCHER (ObjCMethodDecl, isClassMethod) | |
Returns true when the Objective-C method declaration is a class method. | |
AST_MATCHER (ObjCMethodDecl, isInstanceMethod) | |
Returns true when the Objective-C method declaration is an instance method. | |
AST_MATCHER (ObjCMessageExpr, isClassMessage) | |
Returns true when the Objective-C message is sent to a class. | |
AST_MATCHER (ObjCMessageExpr, isInstanceMessage) | |
Returns true when the Objective-C message is sent to an instance. | |
AST_MATCHER_P (ObjCMessageExpr, hasReceiver, internal::Matcher< Expr >, InnerMatcher) | |
Matches if the Objective-C message is sent to an instance, and the inner matcher matches on that instance. | |
AST_MATCHER_P (ObjCMessageExpr, hasSelector, std::string, BaseName) | |
Matches when BaseName == Selector.getAsString() | |
AST_MATCHER_REGEX (ObjCMessageExpr, matchesSelector, RegExp) | |
Matches ObjC selectors whose name contains a substring matched by the given RegExp. | |
AST_MATCHER (ObjCMessageExpr, hasNullSelector) | |
Matches when the selector is the empty selector. | |
AST_MATCHER (ObjCMessageExpr, hasUnarySelector) | |
Matches when the selector is a Unary Selector. | |
AST_MATCHER (ObjCMessageExpr, hasKeywordSelector) | |
Matches when the selector is a keyword selector. | |
AST_MATCHER_P (ObjCMessageExpr, numSelectorArgs, unsigned, N) | |
Matches when the selector has the specified number of arguments. | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (callee, AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXFoldExpr), internal::Matcher< Stmt >, InnerMatcher, 0) | |
Matches if the call or fold expression's callee expression matches. | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (callee, AST_POLYMORPHIC_SUPPORTED_TYPES(ObjCMessageExpr, CallExpr), internal::Matcher< Decl >, InnerMatcher, 1) | |
Matches 1) if the call expression's callee's declaration matches the given matcher; or 2) if the Obj-C message expression's callee's method declaration matches the given matcher. | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (hasType, AST_POLYMORPHIC_SUPPORTED_TYPES(Expr, FriendDecl, TypedefNameDecl, ValueDecl, CXXBaseSpecifier), internal::Matcher< QualType >, InnerMatcher, 0) | |
Matches if the expression's or declaration's type matches a type matcher. | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (hasType, AST_POLYMORPHIC_SUPPORTED_TYPES(Expr, FriendDecl, ValueDecl, CXXBaseSpecifier, ObjCInterfaceDecl), internal::Matcher< Decl >, InnerMatcher, 1) | |
Overloaded to match the declaration of the expression's or value declaration's type. | |
AST_POLYMORPHIC_MATCHER_P (hasTypeLoc, AST_POLYMORPHIC_SUPPORTED_TYPES(BlockDecl, CXXBaseSpecifier, CXXCtorInitializer, CXXFunctionalCastExpr, CXXNewExpr, CXXTemporaryObjectExpr, CXXUnresolvedConstructExpr, CompoundLiteralExpr, DeclaratorDecl, ExplicitCastExpr, ObjCPropertyDecl, TemplateArgumentLoc, TypedefNameDecl), internal::Matcher< TypeLoc >, Inner) | |
Matches if the type location of a node matches the inner matcher. | |
AST_MATCHER_P (QualType, asString, std::string, Name) | |
Matches if the matched type is represented by the given string. | |
AST_MATCHER_P (QualType, pointsTo, internal::Matcher< QualType >, InnerMatcher) | |
Matches if the matched type is a pointer type and the pointee type matches the specified matcher. | |
AST_MATCHER_P_OVERLOAD (QualType, pointsTo, internal::Matcher< Decl >, InnerMatcher, 1) | |
Overloaded to match the pointee type's declaration. | |
AST_MATCHER_P (Type, hasUnqualifiedDesugaredType, internal::Matcher< Type >, InnerMatcher) | |
Matches if the matched type matches the unqualified desugared type of the matched node. | |
AST_MATCHER_P (QualType, references, internal::Matcher< QualType >, InnerMatcher) | |
Matches if the matched type is a reference type and the referenced type matches the specified matcher. | |
AST_MATCHER_P (QualType, hasCanonicalType, internal::Matcher< QualType >, InnerMatcher) | |
Matches QualTypes whose canonical type matches InnerMatcher. | |
AST_MATCHER_P_OVERLOAD (QualType, references, internal::Matcher< Decl >, InnerMatcher, 1) | |
Overloaded to match the referenced type's declaration. | |
AST_MATCHER_P (CXXMemberCallExpr, onImplicitObjectArgument, internal::Matcher< Expr >, InnerMatcher) | |
Matches on the implicit object argument of a member call expression. | |
AST_MATCHER_P_OVERLOAD (CXXMemberCallExpr, thisPointerType, internal::Matcher< QualType >, InnerMatcher, 0) | |
Matches if the type of the expression's implicit object argument either matches the InnerMatcher, or is a pointer to a type that matches the InnerMatcher. | |
AST_MATCHER_P_OVERLOAD (CXXMemberCallExpr, thisPointerType, internal::Matcher< Decl >, InnerMatcher, 1) | |
Overloaded to match the type's declaration. | |
AST_MATCHER_P (DeclRefExpr, to, internal::Matcher< Decl >, InnerMatcher) | |
Matches a DeclRefExpr that refers to a declaration that matches the specified matcher. | |
AST_POLYMORPHIC_MATCHER_P (throughUsingDecl, AST_POLYMORPHIC_SUPPORTED_TYPES(DeclRefExpr, UsingType), internal::Matcher< UsingShadowDecl >, Inner) | |
Matches if a node refers to a declaration through a specific using shadow declaration. | |
AST_MATCHER_P (OverloadExpr, hasAnyDeclaration, internal::Matcher< Decl >, InnerMatcher) | |
Matches an OverloadExpr if any of the declarations in the set of overloads matches the given matcher. | |
AST_MATCHER_P (DeclStmt, hasSingleDecl, internal::Matcher< Decl >, InnerMatcher) | |
Matches the Decl of a DeclStmt which has a single declaration. | |
AST_MATCHER_P (VarDecl, hasInitializer, internal::Matcher< Expr >, InnerMatcher) | |
Matches a variable declaration that has an initializer expression that matches the given matcher. | |
AST_MATCHER (VarDecl, isInitCapture) | |
Matches a variable serving as the implicit variable for a lambda init- capture. | |
AST_MATCHER_P (LambdaExpr, forEachLambdaCapture, internal::Matcher< LambdaCapture >, InnerMatcher) | |
Matches each lambda capture in a lambda expression. | |
AST_MATCHER (VarDecl, isStaticLocal) | |
Matches a static variable with local scope. | |
AST_MATCHER (VarDecl, hasLocalStorage) | |
Matches a variable declaration that has function scope and is a non-static local variable. | |
AST_MATCHER (VarDecl, hasGlobalStorage) | |
Matches a variable declaration that does not have local storage. | |
AST_MATCHER (VarDecl, hasAutomaticStorageDuration) | |
Matches a variable declaration that has automatic storage duration. | |
AST_MATCHER (VarDecl, hasStaticStorageDuration) | |
Matches a variable declaration that has static storage duration. | |
AST_MATCHER (VarDecl, hasThreadStorageDuration) | |
Matches a variable declaration that has thread storage duration. | |
AST_MATCHER (VarDecl, isExceptionVariable) | |
Matches a variable declaration that is an exception variable from a C++ catch block, or an Objective-C @catch statement. | |
AST_POLYMORPHIC_MATCHER_P (argumentCountIs, AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXConstructExpr, CXXUnresolvedConstructExpr, ObjCMessageExpr), unsigned, N) | |
Checks that a call expression or a constructor call expression has a specific number of arguments (including absent default arguments). | |
AST_POLYMORPHIC_MATCHER_P (argumentCountAtLeast, AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXConstructExpr, CXXUnresolvedConstructExpr, ObjCMessageExpr), unsigned, N) | |
Checks that a call expression or a constructor call expression has at least the specified number of arguments (including absent default arguments). | |
AST_POLYMORPHIC_MATCHER_P2 (hasArgument, AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXConstructExpr, CXXUnresolvedConstructExpr, ObjCMessageExpr), unsigned, N, internal::Matcher< Expr >, InnerMatcher) | |
Matches the n'th argument of a call expression or a constructor call expression. | |
AST_MATCHER_P (CXXFoldExpr, hasFoldInit, internal::Matcher< Expr >, InnerMacher) | |
Matches the operand that does not contain the parameter pack. | |
AST_MATCHER_P (CXXFoldExpr, hasPattern, internal::Matcher< Expr >, InnerMacher) | |
Matches the operand that contains the parameter pack. | |
AST_MATCHER (CXXFoldExpr, isRightFold) | |
Matches right-folding fold expressions. | |
AST_MATCHER (CXXFoldExpr, isLeftFold) | |
Matches left-folding fold expressions. | |
AST_MATCHER (CXXFoldExpr, isUnaryFold) | |
Matches unary fold expressions, i.e. | |
AST_MATCHER (CXXFoldExpr, isBinaryFold) | |
Matches binary fold expressions, i.e. | |
AST_MATCHER_P2 (InitListExpr, hasInit, unsigned, N, internal::Matcher< Expr >, InnerMatcher) | |
Matches the n'th item of an initializer list expression. | |
AST_MATCHER_P (DeclStmt, declCountIs, unsigned, N) | |
Matches declaration statements that contain a specific number of declarations. | |
AST_MATCHER_P2 (DeclStmt, containsDeclaration, unsigned, N, internal::Matcher< Decl >, InnerMatcher) | |
Matches the n'th declaration of a declaration statement. | |
AST_MATCHER (CXXCatchStmt, isCatchAll) | |
Matches a C++ catch statement that has a catch-all handler. | |
AST_MATCHER_P (CXXConstructorDecl, hasAnyConstructorInitializer, internal::Matcher< CXXCtorInitializer >, InnerMatcher) | |
Matches a constructor initializer. | |
AST_MATCHER_P (CXXCtorInitializer, forField, internal::Matcher< FieldDecl >, InnerMatcher) | |
Matches the field declaration of a constructor initializer. | |
AST_MATCHER_P (CXXCtorInitializer, withInitializer, internal::Matcher< Expr >, InnerMatcher) | |
Matches the initializer expression of a constructor initializer. | |
AST_MATCHER (CXXCtorInitializer, isWritten) | |
Matches a constructor initializer if it is explicitly written in code (as opposed to implicitly added by the compiler). | |
AST_MATCHER (CXXCtorInitializer, isBaseInitializer) | |
Matches a constructor initializer if it is initializing a base, as opposed to a member. | |
AST_MATCHER (CXXCtorInitializer, isMemberInitializer) | |
Matches a constructor initializer if it is initializing a member, as opposed to a base. | |
AST_POLYMORPHIC_MATCHER_P (hasAnyArgument, AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXConstructExpr, CXXUnresolvedConstructExpr, ObjCMessageExpr), internal::Matcher< Expr >, InnerMatcher) | |
Matches any argument of a call expression or a constructor call expression, or an ObjC-message-send expression. | |
AST_MATCHER_P (LambdaExpr, hasAnyCapture, internal::Matcher< LambdaCapture >, InnerMatcher) | |
Matches any capture in a lambda expression. | |
AST_MATCHER_P (LambdaCapture, capturesVar, internal::Matcher< ValueDecl >, InnerMatcher) | |
Matches a LambdaCapture that refers to the specified VarDecl . | |
AST_MATCHER (LambdaCapture, capturesThis) | |
Matches a LambdaCapture that refers to 'this'. | |
AST_MATCHER (CXXConstructExpr, isListInitialization) | |
Matches a constructor call expression which uses list initialization. | |
AST_MATCHER (CXXConstructExpr, requiresZeroInitialization) | |
Matches a constructor call expression which requires zero initialization. | |
AST_POLYMORPHIC_MATCHER_P2 (hasParameter, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, ObjCMethodDecl, BlockDecl), unsigned, N, internal::Matcher< ParmVarDecl >, InnerMatcher) | |
Matches the n'th parameter of a function or an ObjC method declaration or a block. | |
AST_MATCHER (CXXMethodDecl, isExplicitObjectMemberFunction) | |
Matches if the given method declaration declares a member function with an explicit object parameter. | |
AST_POLYMORPHIC_MATCHER_P2 (forEachArgumentWithParam, AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXConstructExpr), internal::Matcher< Expr >, ArgMatcher, internal::Matcher< ParmVarDecl >, ParamMatcher) | |
Matches all arguments and their respective ParmVarDecl. | |
AST_POLYMORPHIC_MATCHER_P2 (forEachArgumentWithParamType, AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXConstructExpr), internal::Matcher< Expr >, ArgMatcher, internal::Matcher< QualType >, ParamMatcher) | |
Matches all arguments and their respective types for a CallExpr or CXXConstructExpr . | |
AST_MATCHER_P (ParmVarDecl, isAtPosition, unsigned, N) | |
Matches the ParmVarDecl nodes that are at the N'th position in the parameter list. | |
AST_POLYMORPHIC_MATCHER_P (hasAnyParameter, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, ObjCMethodDecl, BlockDecl), internal::Matcher< ParmVarDecl >, InnerMatcher) | |
Matches any parameter of a function or an ObjC method declaration or a block. | |
AST_POLYMORPHIC_MATCHER_P (parameterCountIs, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, FunctionProtoType), unsigned, N) | |
Matches FunctionDecls and FunctionProtoTypes that have a specific parameter count. | |
AST_POLYMORPHIC_MATCHER_P (forEachTemplateArgument, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, TemplateSpecializationType), internal::Matcher< TemplateArgument >, InnerMatcher) | |
Matches templateSpecializationType, class template specialization, variable template specialization, and function template specialization nodes where the template argument matches the inner matcher. | |
AST_MATCHER (FunctionDecl, isNoReturn) | |
Matches FunctionDecls that have a noreturn attribute. | |
AST_MATCHER_P (FunctionDecl, returns, internal::Matcher< QualType >, InnerMatcher) | |
Matches the return type of a function declaration. | |
AST_POLYMORPHIC_MATCHER (isExternC, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl)) | |
Matches extern "C" function or variable declarations. | |
AST_POLYMORPHIC_MATCHER (isStaticStorageClass, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl)) | |
Matches variable/function declarations that have "static" storage class specifier ("static" keyword) written in the source. | |
AST_MATCHER (FunctionDecl, isDeleted) | |
Matches deleted function declarations. | |
AST_MATCHER (FunctionDecl, isDefaulted) | |
Matches defaulted function declarations. | |
AST_MATCHER (FunctionDecl, isWeak) | |
Matches weak function declarations. | |
AST_POLYMORPHIC_MATCHER (hasDynamicExceptionSpec, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, FunctionProtoType)) | |
Matches functions that have a dynamic exception specification. | |
AST_POLYMORPHIC_MATCHER (isNoThrow, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, FunctionProtoType)) | |
Matches functions that have a non-throwing exception specification. | |
AST_POLYMORPHIC_MATCHER (isConsteval, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, IfStmt)) | |
Matches consteval function declarations and if consteval/if ! consteval statements. | |
AST_POLYMORPHIC_MATCHER (isConstexpr, AST_POLYMORPHIC_SUPPORTED_TYPES(VarDecl, FunctionDecl, IfStmt)) | |
Matches constexpr variable and function declarations, and if constexpr. | |
AST_MATCHER (VarDecl, isConstinit) | |
Matches constinit variable declarations. | |
AST_POLYMORPHIC_MATCHER_P (hasInitStatement, AST_POLYMORPHIC_SUPPORTED_TYPES(IfStmt, SwitchStmt, CXXForRangeStmt), internal::Matcher< Stmt >, InnerMatcher) | |
Matches selection statements with initializer. | |
AST_POLYMORPHIC_MATCHER_P (hasCondition, AST_POLYMORPHIC_SUPPORTED_TYPES(IfStmt, ForStmt, WhileStmt, DoStmt, SwitchStmt, AbstractConditionalOperator), internal::Matcher< Expr >, InnerMatcher) | |
Matches the condition expression of an if statement, for loop, switch statement or conditional operator. | |
AST_MATCHER_P (IfStmt, hasThen, internal::Matcher< Stmt >, InnerMatcher) | |
Matches the then-statement of an if statement. | |
AST_MATCHER_P (IfStmt, hasElse, internal::Matcher< Stmt >, InnerMatcher) | |
Matches the else-statement of an if statement. | |
AST_POLYMORPHIC_MATCHER_P (equalsBoundNode, AST_POLYMORPHIC_SUPPORTED_TYPES(Stmt, Decl, Type, QualType), std::string, ID) | |
Matches if a node equals a previously bound node. | |
AST_MATCHER_P (IfStmt, hasConditionVariableStatement, internal::Matcher< DeclStmt >, InnerMatcher) | |
Matches the condition variable statement in an if statement. | |
AST_MATCHER_P (ArraySubscriptExpr, hasIndex, internal::Matcher< Expr >, InnerMatcher) | |
Matches the index expression of an array subscript expression. | |
AST_MATCHER_P (ArraySubscriptExpr, hasBase, internal::Matcher< Expr >, InnerMatcher) | |
Matches the base expression of an array subscript expression. | |
AST_POLYMORPHIC_MATCHER_P (hasBody, AST_POLYMORPHIC_SUPPORTED_TYPES(DoStmt, ForStmt, WhileStmt, CXXForRangeStmt, FunctionDecl, CoroutineBodyStmt), internal::Matcher< Stmt >, InnerMatcher) | |
Matches a 'for', 'while', 'while' statement or a function or coroutine definition that has a given body. | |
AST_MATCHER_P (FunctionDecl, hasAnyBody, internal::Matcher< Stmt >, InnerMatcher) | |
Matches a function declaration that has a given body present in the AST. | |
AST_POLYMORPHIC_MATCHER_P (hasAnySubstatement, AST_POLYMORPHIC_SUPPORTED_TYPES(CompoundStmt, StmtExpr), internal::Matcher< Stmt >, InnerMatcher) | |
Matches compound statements where at least one substatement matches a given matcher. | |
AST_MATCHER_P (CompoundStmt, statementCountIs, unsigned, N) | |
Checks that a compound statement contains a specific number of child statements. | |
template<typename ValueT > | |
internal::PolymorphicMatcher< internal::ValueEqualsMatcher, void(internal::AllNodeBaseTypes), ValueT > | equals (const ValueT &Value) |
Matches literals that are equal to the given value of type ValueT. | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (equals, AST_POLYMORPHIC_SUPPORTED_TYPES(CharacterLiteral, CXXBoolLiteralExpr, IntegerLiteral), bool, Value, 0) | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (equals, AST_POLYMORPHIC_SUPPORTED_TYPES(CharacterLiteral, CXXBoolLiteralExpr, IntegerLiteral), unsigned, Value, 1) | |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD (equals, AST_POLYMORPHIC_SUPPORTED_TYPES(CharacterLiteral, CXXBoolLiteralExpr, FloatingLiteral, IntegerLiteral), double, Value, 2) | |
AST_POLYMORPHIC_MATCHER_P (hasOperatorName, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, CXXFoldExpr, UnaryOperator), std::string, Name) | |
Matches the operator Name of operator expressions and fold expressions (binary or unary). | |
AST_POLYMORPHIC_MATCHER (isAssignmentOperator, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator)) | |
Matches all kinds of assignment operators. | |
AST_POLYMORPHIC_MATCHER (isComparisonOperator, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator)) | |
Matches comparison operators. | |
AST_POLYMORPHIC_MATCHER_P (hasLHS, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, ArraySubscriptExpr, CXXFoldExpr), internal::Matcher< Expr >, InnerMatcher) | |
Matches the left hand side of binary operator expressions. | |
AST_POLYMORPHIC_MATCHER_P (hasRHS, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, ArraySubscriptExpr, CXXFoldExpr), internal::Matcher< Expr >, InnerMatcher) | |
Matches the right hand side of binary operator expressions. | |
AST_POLYMORPHIC_MATCHER_P (hasEitherOperand, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXFoldExpr, CXXRewrittenBinaryOperator), internal::Matcher< Expr >, InnerMatcher) | |
Matches if either the left hand side or the right hand side of a binary operator or fold expression matches. | |
AST_POLYMORPHIC_MATCHER_P2 (hasOperands, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXFoldExpr, CXXRewrittenBinaryOperator), internal::Matcher< Expr >, Matcher1, internal::Matcher< Expr >, Matcher2) | |
Matches if both matchers match with opposite sides of the binary operator or fold expression. | |
AST_POLYMORPHIC_MATCHER_P (hasUnaryOperand, AST_POLYMORPHIC_SUPPORTED_TYPES(UnaryOperator, CXXOperatorCallExpr), internal::Matcher< Expr >, InnerMatcher) | |
Matches if the operand of a unary operator matches. | |
AST_POLYMORPHIC_MATCHER_P (hasSourceExpression, AST_POLYMORPHIC_SUPPORTED_TYPES(CastExpr, OpaqueValueExpr), internal::Matcher< Expr >, InnerMatcher) | |
Matches if the cast's source expression or opaque value's source expression matches the given matcher. | |
AST_MATCHER_P (CastExpr, hasCastKind, CastKind, Kind) | |
Matches casts that has a given cast kind. | |
AST_MATCHER_P (ExplicitCastExpr, hasDestinationType, internal::Matcher< QualType >, InnerMatcher) | |
Matches casts whose destination type matches a given matcher. | |
AST_MATCHER_P (ImplicitCastExpr, hasImplicitDestinationType, internal::Matcher< QualType >, InnerMatcher) | |
Matches implicit casts whose destination type matches a given matcher. | |
AST_MATCHER (TagDecl, isStruct) | |
Matches TagDecl object that are spelled with "struct.". | |
AST_MATCHER (TagDecl, isUnion) | |
Matches TagDecl object that are spelled with "union.". | |
AST_MATCHER (TagDecl, isClass) | |
Matches TagDecl object that are spelled with "class.". | |
AST_MATCHER (TagDecl, isEnum) | |
Matches TagDecl object that are spelled with "enum.". | |
AST_MATCHER_P (AbstractConditionalOperator, hasTrueExpression, internal::Matcher< Expr >, InnerMatcher) | |
Matches the true branch expression of a conditional operator. | |
AST_MATCHER_P (AbstractConditionalOperator, hasFalseExpression, internal::Matcher< Expr >, InnerMatcher) | |
Matches the false branch expression of a conditional operator (binary or ternary). | |
AST_POLYMORPHIC_MATCHER (isDefinition, AST_POLYMORPHIC_SUPPORTED_TYPES(TagDecl, VarDecl, ObjCMethodDecl, FunctionDecl)) | |
Matches if a declaration has a body attached. | |
AST_MATCHER (FunctionDecl, isVariadic) | |
Matches if a function declaration is variadic. | |
AST_MATCHER_P (CXXMethodDecl, ofClass, internal::Matcher< CXXRecordDecl >, InnerMatcher) | |
Matches the class declaration that the given method declaration belongs to. | |
AST_MATCHER_P (CXXMethodDecl, forEachOverridden, internal::Matcher< CXXMethodDecl >, InnerMatcher) | |
Matches each method overridden by the given method. | |
AST_POLYMORPHIC_MATCHER (isVirtual, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXMethodDecl, CXXBaseSpecifier)) | |
Matches declarations of virtual methods and C++ base specifers that specify virtual inheritance. | |
AST_MATCHER (CXXMethodDecl, isVirtualAsWritten) | |
Matches if the given method declaration has an explicit "virtual". | |
AST_MATCHER (CXXConstructorDecl, isInheritingConstructor) | |
AST_POLYMORPHIC_MATCHER (isFinal, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, CXXMethodDecl)) | |
Matches if the given method or class declaration is final. | |
AST_MATCHER (CXXMethodDecl, isPure) | |
Matches if the given method declaration is pure. | |
AST_MATCHER (CXXMethodDecl, isConst) | |
Matches if the given method declaration is const. | |
AST_MATCHER (CXXMethodDecl, isCopyAssignmentOperator) | |
Matches if the given method declaration declares a copy assignment operator. | |
AST_MATCHER (CXXMethodDecl, isMoveAssignmentOperator) | |
Matches if the given method declaration declares a move assignment operator. | |
AST_MATCHER (CXXMethodDecl, isOverride) | |
Matches if the given method declaration overrides another method. | |
AST_MATCHER (CXXMethodDecl, isUserProvided) | |
Matches method declarations that are user-provided. | |
AST_POLYMORPHIC_MATCHER (isArrow, AST_POLYMORPHIC_SUPPORTED_TYPES(MemberExpr, UnresolvedMemberExpr, CXXDependentScopeMemberExpr)) | |
Matches member expressions that are called with '->' as opposed to '. | |
AST_MATCHER (QualType, isInteger) | |
Matches QualType nodes that are of integer type. | |
AST_MATCHER (QualType, isUnsignedInteger) | |
Matches QualType nodes that are of unsigned integer type. | |
AST_MATCHER (QualType, isSignedInteger) | |
Matches QualType nodes that are of signed integer type. | |
AST_MATCHER (QualType, isAnyCharacter) | |
Matches QualType nodes that are of character type. | |
AST_MATCHER (QualType, isAnyPointer) | |
Matches QualType nodes that are of any pointer type; this includes the Objective-C object pointer type, which is different despite being syntactically similar. | |
AST_MATCHER (QualType, isConstQualified) | |
Matches QualType nodes that are const-qualified, i.e., that include "top-level" const. | |
AST_MATCHER (QualType, isVolatileQualified) | |
Matches QualType nodes that are volatile-qualified, i.e., that include "top-level" volatile. | |
AST_MATCHER (QualType, hasLocalQualifiers) | |
Matches QualType nodes that have local CV-qualifiers attached to the node, not hidden within a typedef. | |
AST_MATCHER_P (MemberExpr, member, internal::Matcher< ValueDecl >, InnerMatcher) | |
Matches a member expression where the member is matched by a given matcher. | |
AST_POLYMORPHIC_MATCHER_P (hasObjectExpression, AST_POLYMORPHIC_SUPPORTED_TYPES(MemberExpr, UnresolvedMemberExpr, CXXDependentScopeMemberExpr), internal::Matcher< Expr >, InnerMatcher) | |
Matches a member expression where the object expression is matched by a given matcher. | |
AST_MATCHER_P (BaseUsingDecl, hasAnyUsingShadowDecl, internal::Matcher< UsingShadowDecl >, InnerMatcher) | |
Matches any using shadow declaration. | |
AST_MATCHER_P (UsingShadowDecl, hasTargetDecl, internal::Matcher< NamedDecl >, InnerMatcher) | |
Matches a using shadow declaration where the target declaration is matched by the given matcher. | |
AST_POLYMORPHIC_MATCHER (isTemplateInstantiation, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl, CXXRecordDecl)) | |
Matches template instantiations of function, class, or static member variable template instantiations. | |
AST_MATCHER_FUNCTION (internal::Matcher< Decl >, isInstantiated) | |
Matches declarations that are template instantiations or are inside template instantiations. | |
AST_MATCHER_FUNCTION (internal::Matcher< Stmt >, isInTemplateInstantiation) | |
Matches statements inside of a template instantiation. | |
AST_POLYMORPHIC_MATCHER (isExplicitTemplateSpecialization, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl, CXXRecordDecl)) | |
Matches explicit template specializations of function, class, or static member variable template instantiations. | |
AST_MATCHER_FUNCTION_P_OVERLOAD (internal::BindableMatcher< TypeLoc >, loc, internal::Matcher< QualType >, InnerMatcher, 0) | |
Matches TypeLocs for which the given inner QualType-matcher matches. | |
AST_MATCHER_P (QualifiedTypeLoc, hasUnqualifiedLoc, internal::Matcher< TypeLoc >, InnerMatcher) | |
Matches QualifiedTypeLoc s that have an unqualified TypeLoc matching InnerMatcher . | |
AST_MATCHER_P (FunctionDecl, hasReturnTypeLoc, internal::Matcher< TypeLoc >, ReturnMatcher) | |
Matches a function declared with the specified return TypeLoc . | |
AST_MATCHER_P (PointerTypeLoc, hasPointeeLoc, internal::Matcher< TypeLoc >, PointeeMatcher) | |
Matches pointer TypeLoc s that have a pointee TypeLoc matching PointeeMatcher . | |
AST_MATCHER_P (ReferenceTypeLoc, hasReferentLoc, internal::Matcher< TypeLoc >, ReferentMatcher) | |
Matches reference TypeLoc s that have a referent TypeLoc matching ReferentMatcher . | |
AST_POLYMORPHIC_MATCHER_P (hasAnyTemplateArgumentLoc, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, DeclRefExpr, TemplateSpecializationTypeLoc), internal::Matcher< TemplateArgumentLoc >, InnerMatcher) | |
Matches template specialization TypeLoc s, class template specializations, variable template specializations, and function template specializations that have at least one TemplateArgumentLoc matching the given InnerMatcher . | |
AST_POLYMORPHIC_MATCHER_P2 (hasTemplateArgumentLoc, AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, DeclRefExpr, TemplateSpecializationTypeLoc), unsigned, Index, internal::Matcher< TemplateArgumentLoc >, InnerMatcher) | |
Matches template specialization TypeLoc s, class template specializations, variable template specializations, and function template specializations where the n'th TemplateArgumentLoc matches the given InnerMatcher . | |
AST_MATCHER_P (ElaboratedTypeLoc, hasNamedTypeLoc, internal::Matcher< TypeLoc >, InnerMatcher) | |
Matches elaborated TypeLoc s that have a named TypeLoc matching InnerMatcher . | |
AST_MATCHER (Type, booleanType) | |
Matches type bool . | |
AST_MATCHER (Type, voidType) | |
Matches type void . | |
AST_MATCHER (Type, realFloatingPointType) | |
Matches any real floating-point type (float, double, long double). | |
AST_TYPELOC_TRAVERSE_MATCHER_DECL (hasElementType, getElement, AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType, ComplexType)) | |
Matches arrays and C99 complex types that have a specific element type. | |
AST_POLYMORPHIC_MATCHER_P (hasSize, AST_POLYMORPHIC_SUPPORTED_TYPES(ConstantArrayType, StringLiteral), unsigned, N) | |
Matches nodes that have the specified size. | |
AST_MATCHER_P (VariableArrayType, hasSizeExpr, internal::Matcher< Expr >, InnerMatcher) | |
Matches VariableArrayType nodes that have a specific size expression. | |
AST_TYPELOC_TRAVERSE_MATCHER_DECL (hasValueType, getValue, AST_POLYMORPHIC_SUPPORTED_TYPES(AtomicType)) | |
Matches atomic types with a specific value type. | |
AST_TYPE_TRAVERSE_MATCHER (hasDeducedType, getDeducedType, AST_POLYMORPHIC_SUPPORTED_TYPES(AutoType)) | |
Matches AutoType nodes where the deduced type is a specific type. | |
AST_TYPE_TRAVERSE_MATCHER (hasUnderlyingType, getUnderlyingType, AST_POLYMORPHIC_SUPPORTED_TYPES(DecltypeType, UsingType)) | |
Matches DecltypeType or UsingType nodes to find the underlying type. | |
AST_TYPE_TRAVERSE_MATCHER (innerType, getInnerType, AST_POLYMORPHIC_SUPPORTED_TYPES(ParenType)) | |
Matches ParenType nodes where the inner type is a specific type. | |
AST_TYPELOC_TRAVERSE_MATCHER_DECL (pointee, getPointee, AST_POLYMORPHIC_SUPPORTED_TYPES(BlockPointerType, MemberPointerType, PointerType, ReferenceType, ObjCObjectPointerType)) | |
Narrows PointerType (and similar) matchers to those where the pointee matches a given matcher. | |
AST_MATCHER_P (ElaboratedType, hasQualifier, internal::Matcher< NestedNameSpecifier >, InnerMatcher) | |
Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier, matches InnerMatcher if the qualifier exists. | |
AST_MATCHER_P (ElaboratedType, namesType, internal::Matcher< QualType >, InnerMatcher) | |
Matches ElaboratedTypes whose named type matches InnerMatcher . | |
AST_TYPE_TRAVERSE_MATCHER (hasReplacementType, getReplacementType, AST_POLYMORPHIC_SUPPORTED_TYPES(SubstTemplateTypeParmType)) | |
Matches template type parameter substitutions that have a replacement type that matches the provided matcher. | |
AST_MATCHER_P (DecayedType, hasDecayedType, internal::Matcher< QualType >, InnerType) | |
Matches the decayed type, whoes decayed type matches InnerMatcher . | |
AST_MATCHER_P (Decl, hasDeclContext, internal::Matcher< Decl >, InnerMatcher) | |
Matches declarations whose declaration context, interpreted as a Decl, matches InnerMatcher . | |
AST_MATCHER_FUNCTION_P_OVERLOAD (internal::BindableMatcher< NestedNameSpecifierLoc >, loc, internal::Matcher< NestedNameSpecifier >, InnerMatcher, 1) | |
Matches NestedNameSpecifierLocs for which the given inner NestedNameSpecifier-matcher matches. | |
AST_MATCHER_P (NestedNameSpecifier, specifiesType, internal::Matcher< QualType >, InnerMatcher) | |
Matches nested name specifiers that specify a type matching the given QualType matcher without qualifiers. | |
AST_MATCHER_P (NestedNameSpecifierLoc, specifiesTypeLoc, internal::Matcher< TypeLoc >, InnerMatcher) | |
Matches nested name specifier locs that specify a type matching the given TypeLoc . | |
AST_MATCHER_P_OVERLOAD (NestedNameSpecifier, hasPrefix, internal::Matcher< NestedNameSpecifier >, InnerMatcher, 0) | |
Matches on the prefix of a NestedNameSpecifier . | |
AST_MATCHER_P_OVERLOAD (NestedNameSpecifierLoc, hasPrefix, internal::Matcher< NestedNameSpecifierLoc >, InnerMatcher, 1) | |
Matches on the prefix of a NestedNameSpecifierLoc . | |
AST_MATCHER_P (NestedNameSpecifier, specifiesNamespace, internal::Matcher< NamespaceDecl >, InnerMatcher) | |
Matches nested name specifiers that specify a namespace matching the given namespace matcher. | |
AST_MATCHER_P (SwitchStmt, forEachSwitchCase, internal::Matcher< SwitchCase >, InnerMatcher) | |
Matches each case or default statement belonging to the given switch statement. | |
AST_MATCHER_P (CXXConstructorDecl, forEachConstructorInitializer, internal::Matcher< CXXCtorInitializer >, InnerMatcher) | |
Matches each constructor initializer in a constructor definition. | |
AST_MATCHER (CXXConstructorDecl, isCopyConstructor) | |
Matches constructor declarations that are copy constructors. | |
AST_MATCHER (CXXConstructorDecl, isMoveConstructor) | |
Matches constructor declarations that are move constructors. | |
AST_MATCHER (CXXConstructorDecl, isDefaultConstructor) | |
Matches constructor declarations that are default constructors. | |
AST_MATCHER (CXXConstructorDecl, isDelegatingConstructor) | |
Matches constructors that delegate to another constructor. | |
AST_POLYMORPHIC_MATCHER (isExplicit, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXConstructorDecl, CXXConversionDecl, CXXDeductionGuideDecl)) | |
Matches constructor, conversion function, and deduction guide declarations that have an explicit specifier if this explicit specifier is resolved to true. | |
AST_MATCHER_P (FunctionDecl, hasExplicitSpecifier, internal::Matcher< Expr >, InnerMatcher) | |
Matches the expression in an explicit specifier if present in the given declaration. | |
AST_POLYMORPHIC_MATCHER (isInline, AST_POLYMORPHIC_SUPPORTED_TYPES(NamespaceDecl, FunctionDecl, VarDecl)) | |
Matches functions, variables and namespace declarations that are marked with the inline keyword. | |
AST_MATCHER (NamespaceDecl, isAnonymous) | |
Matches anonymous namespace declarations. | |
AST_MATCHER (Decl, isInStdNamespace) | |
Matches declarations in the namespace std , but not in nested namespaces. | |
AST_MATCHER (Decl, isInAnonymousNamespace) | |
Matches declarations in an anonymous namespace. | |
AST_MATCHER_P (CaseStmt, hasCaseConstant, internal::Matcher< Expr >, InnerMatcher) | |
If the given case statement does not use the GNU case range extension, matches the constant given in the statement. | |
AST_MATCHER_P (Decl, hasAttr, attr::Kind, AttrKind) | |
Matches declaration that has a given attribute. | |
AST_MATCHER_P (ReturnStmt, hasReturnValue, internal::Matcher< Expr >, InnerMatcher) | |
Matches the return value expression of a return statement. | |
AST_MATCHER_FUNCTION (internal::Matcher< Expr >, nullPointerConstant) | |
Matches expressions that resolve to a null pointer constant, such as GNU's __null, C++11's nullptr, or C's NULL macro. | |
AST_MATCHER_P (BindingDecl, forDecomposition, internal::Matcher< ValueDecl >, InnerMatcher) | |
Matches the DecompositionDecl the binding belongs to. | |
AST_MATCHER_P2 (DecompositionDecl, hasBinding, unsigned, N, internal::Matcher< BindingDecl >, InnerMatcher) | |
Matches the Nth binding of a DecompositionDecl. | |
AST_MATCHER_P (DecompositionDecl, hasAnyBinding, internal::Matcher< BindingDecl >, InnerMatcher) | |
Matches any binding of a DecompositionDecl. | |
AST_MATCHER_P (Stmt, forFunction, internal::Matcher< FunctionDecl >, InnerMatcher) | |
Matches declaration of the function the statement belongs to. | |
AST_MATCHER_P (Stmt, forCallable, internal::Matcher< Decl >, InnerMatcher) | |
Matches declaration of the function, method, or block the statement belongs to. | |
AST_MATCHER (NamedDecl, hasExternalFormalLinkage) | |
Matches a declaration that has external formal linkage. | |
AST_MATCHER (ParmVarDecl, hasDefaultArgument) | |
Matches a declaration that has default arguments. | |
AST_MATCHER (CXXNewExpr, isArray) | |
Matches array new expressions. | |
AST_MATCHER_P2 (CXXNewExpr, hasPlacementArg, unsigned, Index, internal::Matcher< Expr >, InnerMatcher) | |
Matches placement new expression arguments. | |
AST_MATCHER_P (CXXNewExpr, hasAnyPlacementArg, internal::Matcher< Expr >, InnerMatcher) | |
Matches any placement new expression arguments. | |
AST_MATCHER_P (CXXNewExpr, hasArraySize, internal::Matcher< Expr >, InnerMatcher) | |
Matches array new expressions with a given array size. | |
AST_MATCHER (CXXRecordDecl, hasDefinition) | |
Matches a class declaration that is defined. | |
AST_MATCHER (EnumDecl, isScoped) | |
Matches C++11 scoped enum declaration. | |
AST_MATCHER (FunctionDecl, hasTrailingReturn) | |
Matches a function declared with a trailing return type. | |
AST_MATCHER_P (Expr, ignoringElidableConstructorCall, internal::Matcher< Expr >, InnerMatcher) | |
Matches expressions that match InnerMatcher that are possibly wrapped in an elidable constructor and other corresponding bookkeeping nodes. | |
AST_MATCHER (OMPExecutableDirective, isStandaloneDirective) | |
Matches standalone OpenMP directives, i.e., directives that can't have a structured block. | |
AST_MATCHER_P (OMPExecutableDirective, hasStructuredBlock, internal::Matcher< Stmt >, InnerMatcher) | |
Matches the structured-block of the OpenMP executable directive. | |
AST_MATCHER_P (OMPExecutableDirective, hasAnyClause, internal::Matcher< OMPClause >, InnerMatcher) | |
Matches any clause in an OpenMP directive. | |
AST_MATCHER (OMPDefaultClause, isNoneKind) | |
Matches if the OpenMP default clause has none kind specified. | |
AST_MATCHER (OMPDefaultClause, isSharedKind) | |
Matches if the OpenMP default clause has shared kind specified. | |
AST_MATCHER (OMPDefaultClause, isPrivateKind) | |
Matches if the OpenMP default clause has private kind specified. | |
AST_MATCHER (OMPDefaultClause, isFirstPrivateKind) | |
Matches if the OpenMP default clause has firstprivate kind specified. | |
AST_MATCHER_P (OMPExecutableDirective, isAllowedToContainClauseKind, OpenMPClauseKind, CKind) | |
Matches if the OpenMP directive is allowed to contain the specified OpenMP clause kind. | |
template<typename MatcherT > | |
SmallVector< BoundNodes, 1 > | match (MatcherT Matcher, ASTContext &Context) |
Returns the results of matching Matcher on the translation unit of Context and collects the BoundNodes of all callback invocations. | |
template<typename NodeT > | |
const NodeT * | selectFirst (StringRef BoundTo, const SmallVectorImpl< BoundNodes > &Results) |
Returns the first result of type NodeT bound to BoundTo . | |
SmallVector< BoundNodes, 1 > | matchDynamic (internal::DynTypedMatcher Matcher, const DynTypedNode &Node, ASTContext &Context) |
template<typename NodeT > | |
SmallVector< BoundNodes, 1 > | matchDynamic (internal::DynTypedMatcher Matcher, const NodeT &Node, ASTContext &Context) |
SmallVector< BoundNodes, 1 > | matchDynamic (internal::DynTypedMatcher Matcher, ASTContext &Context) |
internal::BindableMatcher< Stmt > | gtestAssert (GtestCmp Cmp, StatementMatcher Left, StatementMatcher Right) |
Matcher for gtest's ASSERT comparison macros including ASSERT_EQ, ASSERT_NE, ASSERT_GE, ASSERT_GT, ASSERT_LE and ASSERT_LT. | |
internal::BindableMatcher< Stmt > | gtestAssertThat (StatementMatcher Actual, StatementMatcher Matcher) |
Matcher for gtest's ASSERT_THAT macro. | |
internal::BindableMatcher< Stmt > | gtestExpect (GtestCmp Cmp, StatementMatcher Left, StatementMatcher Right) |
Matcher for gtest's EXPECT comparison macros including EXPECT_EQ, EXPECT_NE, EXPECT_GE, EXPECT_GT, EXPECT_LE and EXPECT_LT. | |
internal::BindableMatcher< Stmt > | gtestExpectThat (StatementMatcher Actual, StatementMatcher Matcher) |
Matcher for gtest's EXPECT_THAT macro. | |
internal::BindableMatcher< Stmt > | gtestExpectCall (StatementMatcher MockObject, llvm::StringRef MockMethodName, MockArgs Args) |
Matcher for gtest's EXPECT_CALL macro. | |
internal::BindableMatcher< Stmt > | gtestExpectCall (StatementMatcher MockCall, MockArgs Args) |
Matcher for gtest's EXPECT_CALL macro. | |
internal::BindableMatcher< Stmt > | gtestOnCall (StatementMatcher MockObject, llvm::StringRef MockMethodName, MockArgs Args) |
Like the first gtestExpectCall overload but for ON_CALL . | |
internal::BindableMatcher< Stmt > | gtestOnCall (StatementMatcher MockCall, MockArgs Args) |
Like the second gtestExpectCall overload but for ON_CALL . | |
static auto | hasPointerType () |
static auto | hasArrayType () |
AST_MATCHER_P (Stmt, forEachDescendantEvaluatedStmt, internal::Matcher< Stmt >, innerMatcher) | |
AST_MATCHER_P (Stmt, forEachDescendantStmt, internal::Matcher< Stmt >, innerMatcher) | |
AST_MATCHER_P (Stmt, notInSafeBufferOptOut, const UnsafeBufferUsageHandler *, Handler) | |
AST_MATCHER_P (Stmt, ignoreUnsafeBufferInContainer, const UnsafeBufferUsageHandler *, Handler) | |
AST_MATCHER_P (Stmt, ignoreUnsafeLibcCall, const UnsafeBufferUsageHandler *, Handler) | |
AST_MATCHER_P (CastExpr, castSubExpr, internal::Matcher< Expr >, innerMatcher) | |
AST_MATCHER (UnaryOperator, isPreInc) | |
static auto | isInUnspecifiedLvalueContext (internal::Matcher< Expr > innerMatcher) |
static internal::Matcher< Stmt > | isInUnspecifiedPointerContext (internal::Matcher< Stmt > InnerMatcher) |
static internal::Matcher< Stmt > | isInUnspecifiedUntypedContext (internal::Matcher< Stmt > InnerMatcher) |
AST_MATCHER (CXXConstructExpr, isSafeSpanTwoParamConstruct) | |
AST_MATCHER (ArraySubscriptExpr, isSafeArraySubscript) | |
AST_MATCHER_P (CallExpr, hasNumArgs, unsigned, Num) | |
AST_MATCHER_P (ObjCMessageExpr, hasAnySelectorMatcher, std::vector< std::string >, Matches) | |
AST_TYPELOC_TRAVERSE_MATCHER_DEF (hasElementType, AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType, ComplexType)) | |
AST_TYPELOC_TRAVERSE_MATCHER_DEF (hasValueType, AST_POLYMORPHIC_SUPPORTED_TYPES(AtomicType)) | |
AST_TYPELOC_TRAVERSE_MATCHER_DEF (pointee, AST_POLYMORPHIC_SUPPORTED_TYPES(BlockPointerType, MemberPointerType, PointerType, ReferenceType, ObjCObjectPointerType)) | |
static DeclarationMatcher | getComparisonDecl (GtestCmp Cmp) |
static llvm::StringRef | getMacroTypeName (MacroType Macro) |
static llvm::StringRef | getComparisonTypeName (GtestCmp Cmp) |
static std::string | getMacroName (MacroType Macro, GtestCmp Cmp) |
static std::string | getMacroName (MacroType Macro, llvm::StringRef Operation) |
static llvm::StringRef | getSpecSetterName (MacroType Macro) |
static internal::BindableMatcher< Stmt > | gtestComparisonInternal (MacroType Macro, GtestCmp Cmp, StatementMatcher Left, StatementMatcher Right) |
static internal::BindableMatcher< Stmt > | gtestThatInternal (MacroType Macro, StatementMatcher Actual, StatementMatcher Matcher) |
static internal::BindableMatcher< Stmt > | gtestCallInternal (MacroType Macro, StatementMatcher MockCall, MockArgs Args) |
static internal::BindableMatcher< Stmt > | gtestCallInternal (MacroType Macro, StatementMatcher MockObject, llvm::StringRef MockMethodName, MockArgs Args) |
AST_MATCHER_P (StringLiteral, mentionsBoundType, std::string, BindingID) | |
AST_MATCHER_P_OVERLOAD (Decl, equalsNode, const Decl *, Other, 0) | |
Overloads for the equalsNode matcher. | |
AST_MATCHER_P_OVERLOAD (Stmt, equalsNode, const Stmt *, Other, 1) | |
Matches if a node equals another node. | |
AST_MATCHER_P_OVERLOAD (Type, equalsNode, const Type *, Other, 2) | |
Matches if a node equals another node. | |
template<typename MatcherT , typename NodeT > | |
SmallVector< BoundNodes, 1 > | match (MatcherT Matcher, const NodeT &Node, ASTContext &Context) |
Returns the results of matching Matcher on Node . | |
template<typename MatcherT > | |
SmallVector< BoundNodes, 1 > | match (MatcherT Matcher, const DynTypedNode &Node, ASTContext &Context) |
Variables | |
const internal::VariadicDynCastAllOfMatcher< Decl, TranslationUnitDecl > | translationUnitDecl |
Matches the top declaration context. | |
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > | typedefDecl |
Matches typedef declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefNameDecl > | typedefNameDecl |
Matches typedef name declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > | typeAliasDecl |
Matches type alias declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasTemplateDecl > | typeAliasTemplateDecl |
Matches type alias template declarations. | |
const internal::VariadicAllOfMatcher< Decl > | decl |
Matches declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, DecompositionDecl > | decompositionDecl |
Matches decomposition-declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, BindingDecl > | bindingDecl |
Matches binding declarations Example matches foo and bar (matcher = bindingDecl() | |
const internal::VariadicDynCastAllOfMatcher< Decl, LinkageSpecDecl > | linkageSpecDecl |
Matches a declaration of a linkage specification. | |
const internal::VariadicDynCastAllOfMatcher< Decl, NamedDecl > | namedDecl |
Matches a declaration of anything that could have a name. | |
const internal::VariadicDynCastAllOfMatcher< Decl, LabelDecl > | labelDecl |
Matches a declaration of label. | |
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceDecl > | namespaceDecl |
Matches a declaration of a namespace. | |
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceAliasDecl > | namespaceAliasDecl |
Matches a declaration of a namespace alias. | |
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > | recordDecl |
Matches class, struct, and union declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > | cxxRecordDecl |
Matches C++ class declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateDecl > | classTemplateDecl |
Matches C++ class template declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateSpecializationDecl > | classTemplateSpecializationDecl |
Matches C++ class template specializations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplatePartialSpecializationDecl > | classTemplatePartialSpecializationDecl |
Matches C++ class template partial specializations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, DeclaratorDecl > | declaratorDecl |
Matches declarator declarations (field, variable, function and non-type template parameter declarations). | |
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > | parmVarDecl |
Matches parameter variable declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, AccessSpecDecl > | accessSpecDecl |
Matches C++ access specifier declarations. | |
const internal::VariadicAllOfMatcher< CXXBaseSpecifier > | cxxBaseSpecifier |
Matches class bases. | |
const internal::VariadicAllOfMatcher< CXXCtorInitializer > | cxxCtorInitializer |
Matches constructor initializers. | |
const internal::VariadicAllOfMatcher< TemplateArgument > | templateArgument |
Matches template arguments. | |
const internal::VariadicAllOfMatcher< TemplateArgumentLoc > | templateArgumentLoc |
Matches template arguments (with location info). | |
const internal::VariadicAllOfMatcher< TemplateName > | templateName |
Matches template name. | |
const internal::VariadicDynCastAllOfMatcher< Decl, NonTypeTemplateParmDecl > | nonTypeTemplateParmDecl |
Matches non-type template parameter declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTypeParmDecl > | templateTypeParmDecl |
Matches template type parameter declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTemplateParmDecl > | templateTemplateParmDecl |
Matches template template parameter declarations. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAutoreleasePoolStmt > | autoreleasePoolStmt |
Matches an Objective-C autorelease pool statement. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ExportDecl > | exportDecl |
Matches any export declaration. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ValueDecl > | valueDecl |
Matches any value declaration. | |
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConstructorDecl > | cxxConstructorDecl |
Matches C++ constructor declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDestructorDecl > | cxxDestructorDecl |
Matches explicit C++ destructor declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, EnumDecl > | enumDecl |
Matches enum declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, EnumConstantDecl > | enumConstantDecl |
Matches enum constants. | |
const internal::VariadicDynCastAllOfMatcher< Decl, TagDecl > | tagDecl |
Matches tag declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > | cxxMethodDecl |
Matches method declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConversionDecl > | cxxConversionDecl |
Matches conversion operator declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDeductionGuideDecl > | cxxDeductionGuideDecl |
Matches user-defined and implicitly generated deduction guide. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ConceptDecl > | conceptDecl |
Matches concept declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > | varDecl |
Matches variable declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, FieldDecl > | fieldDecl |
Matches field declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, IndirectFieldDecl > | indirectFieldDecl |
Matches indirect field declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > | functionDecl |
Matches function declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionTemplateDecl > | functionTemplateDecl |
Matches C++ function template declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, FriendDecl > | friendDecl |
Matches friend declarations. | |
const internal::VariadicAllOfMatcher< Stmt > | stmt |
Matches statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclStmt > | declStmt |
Matches declaration statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, MemberExpr > | memberExpr |
Matches member expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedMemberExpr > | unresolvedMemberExpr |
Matches unresolved member expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDependentScopeMemberExpr > | cxxDependentScopeMemberExpr |
Matches member expressions where the actual member referenced could not be resolved because the base expression or the member name was dependent. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > | callExpr |
Matches call expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > | lambdaExpr |
Matches lambda expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > | cxxMemberCallExpr |
Matches member call expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCMessageExpr > | objcMessageExpr |
Matches ObjectiveC Message invocation expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCStringLiteral > | objcStringLiteral |
Matches ObjectiveC String literal expressions. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCInterfaceDecl > | objcInterfaceDecl |
Matches Objective-C interface declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCImplementationDecl > | objcImplementationDecl |
Matches Objective-C implementation declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCProtocolDecl > | objcProtocolDecl |
Matches Objective-C protocol declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryDecl > | objcCategoryDecl |
Matches Objective-C category declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryImplDecl > | objcCategoryImplDecl |
Matches Objective-C category definitions. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCMethodDecl > | objcMethodDecl |
Matches Objective-C method declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, BlockDecl > | blockDecl |
Matches block declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCIvarDecl > | objcIvarDecl |
Matches Objective-C instance variable declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCPropertyDecl > | objcPropertyDecl |
Matches Objective-C property declarations. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtThrowStmt > | objcThrowStmt |
Matches Objective-C @throw statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtTryStmt > | objcTryStmt |
Matches Objective-C @try statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtCatchStmt > | objcCatchStmt |
Matches Objective-C @catch statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtFinallyStmt > | objcFinallyStmt |
Matches Objective-C @finally statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ExprWithCleanups > | exprWithCleanups |
Matches expressions that introduce cleanups to be run at the end of the sub-expression's evaluation. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > | initListExpr |
Matches init list expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStdInitializerListExpr > | cxxStdInitializerListExpr |
Matches C++ initializer list expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitValueInitExpr > | implicitValueInitExpr |
Matches implicit initializers of init list expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > | parenListExpr |
Matches paren list expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, SubstNonTypeTemplateParmExpr > | substNonTypeTemplateParmExpr |
Matches substitutions of non-type template parameters. | |
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDecl > | usingDecl |
Matches using declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, UsingEnumDecl > | usingEnumDecl |
Matches using-enum declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDirectiveDecl > | usingDirectiveDecl |
Matches using namespace declarations. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedLookupExpr > | unresolvedLookupExpr |
Matches reference to a name that can be looked up during parsing but could not be resolved to a specific declaration. | |
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > | unresolvedUsingValueDecl |
Matches unresolved using value declarations. | |
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingTypenameDecl > | unresolvedUsingTypenameDecl |
Matches unresolved using value declarations that involve the typename. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ConstantExpr > | constantExpr |
Matches a constant expression wrapper. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenExpr > | parenExpr |
Matches parentheses used in expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstructExpr > | cxxConstructExpr |
Matches constructor call expressions (including implicit ones). | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXUnresolvedConstructExpr > | cxxUnresolvedConstructExpr |
Matches unresolved constructor call expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThisExpr > | cxxThisExpr |
Matches implicit and explicit this expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBindTemporaryExpr > | cxxBindTemporaryExpr |
Matches nodes where temporaries are created. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, MaterializeTemporaryExpr > | materializeTemporaryExpr |
Matches nodes where temporaries are materialized. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNewExpr > | cxxNewExpr |
Matches new expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDeleteExpr > | cxxDeleteExpr |
Matches delete expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNoexceptExpr > | cxxNoexceptExpr |
Matches noexcept expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ArrayInitLoopExpr > | arrayInitLoopExpr |
Matches a loop initializing the elements of an array in a number of contexts: | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ArrayInitIndexExpr > | arrayInitIndexExpr |
The arrayInitIndexExpr consists of two subexpressions: a common expression (the source array) that is evaluated once up-front, and a per-element initializer that runs once for each array element. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > | arraySubscriptExpr |
Matches array subscript expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDefaultArgExpr > | cxxDefaultArgExpr |
Matches the value of a default argument at the call site. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > | cxxOperatorCallExpr |
Matches overloaded operator calls. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFoldExpr > | cxxFoldExpr |
Matches C++17 fold expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXRewrittenBinaryOperator > | cxxRewrittenBinaryOperator |
Matches rewritten binary operators. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > | expr |
Matches expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > | declRefExpr |
Matches expressions that refer to declarations. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCIvarRefExpr > | objcIvarRefExpr |
Matches a reference to an ObjCIvar. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, BlockExpr > | blockExpr |
Matches a reference to a block. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, IfStmt > | ifStmt |
Matches if statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ForStmt > | forStmt |
Matches for statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXForRangeStmt > | cxxForRangeStmt |
Matches range-based for statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, WhileStmt > | whileStmt |
Matches while statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, DoStmt > | doStmt |
Matches do statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, BreakStmt > | breakStmt |
Matches break statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ContinueStmt > | continueStmt |
Matches continue statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CoreturnStmt > | coreturnStmt |
Matches co_return statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > | returnStmt |
Matches return statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, GotoStmt > | gotoStmt |
Matches goto statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, LabelStmt > | labelStmt |
Matches label statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, AddrLabelExpr > | addrLabelExpr |
Matches address of label statements (GNU extension). | |
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > | switchStmt |
Matches switch statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchCase > | switchCase |
Matches case and default statements inside switch statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CaseStmt > | caseStmt |
Matches case statements inside switch statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, DefaultStmt > | defaultStmt |
Matches default statements inside switch statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundStmt > | compoundStmt |
Matches compound statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXCatchStmt > | cxxCatchStmt |
Matches catch statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTryStmt > | cxxTryStmt |
Matches try statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThrowExpr > | cxxThrowExpr |
Matches throw expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, NullStmt > | nullStmt |
Matches null statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, AsmStmt > | asmStmt |
Matches asm statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBoolLiteralExpr > | cxxBoolLiteral |
Matches bool literals. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, StringLiteral > | stringLiteral |
Matches string literals (also matches wide string literals). | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CharacterLiteral > | characterLiteral |
Matches character literals (also matches wchar_t). | |
const internal::VariadicDynCastAllOfMatcher< Stmt, IntegerLiteral > | integerLiteral |
Matches integer literals of all sizes / encodings, e.g. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, FloatingLiteral > | floatLiteral |
Matches float literals of all sizes / encodings, e.g. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ImaginaryLiteral > | imaginaryLiteral |
Matches imaginary literals, which are based on integer and floating point literals e.g.: 1i, 1.0i. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, FixedPointLiteral > | fixedPointLiteral |
Matches fixed point literals. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, UserDefinedLiteral > | userDefinedLiteral |
Matches user defined literal operator call. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundLiteralExpr > | compoundLiteralExpr |
Matches compound (i.e. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CoawaitExpr > | coawaitExpr |
Matches co_await expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, DependentCoawaitExpr > | dependentCoawaitExpr |
Matches co_await expressions where the type of the promise is dependent. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CoyieldExpr > | coyieldExpr |
Matches co_yield expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CoroutineBodyStmt > | coroutineBodyStmt |
Matches coroutine body statements. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNullPtrLiteralExpr > | cxxNullPtrLiteralExpr |
Matches nullptr literal. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ChooseExpr > | chooseExpr |
Matches GNU __builtin_choose_expr. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ConvertVectorExpr > | convertVectorExpr |
Matches builtin function __builtin_convertvector. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, GNUNullExpr > | gnuNullExpr |
Matches GNU __null expression. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, GenericSelectionExpr > | genericSelectionExpr |
Matches C11 _Generic expression. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, AtomicExpr > | atomicExpr |
Matches atomic builtins. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, StmtExpr > | stmtExpr |
Matches statement expression (GNU extension). | |
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > | binaryOperator |
Matches binary operator expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > | unaryOperator |
Matches unary operator expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ConditionalOperator > | conditionalOperator |
Matches conditional operator expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryConditionalOperator > | binaryConditionalOperator |
Matches binary conditional operator expressions (GNU extension). | |
const internal::VariadicDynCastAllOfMatcher< Stmt, OpaqueValueExpr > | opaqueValueExpr |
Matches opaque value expressions. | |
const internal::VariadicDynCastAllOfMatcher< Decl, StaticAssertDecl > | staticAssertDecl |
Matches a C++ static_assert declaration. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXReinterpretCastExpr > | cxxReinterpretCastExpr |
Matches a reinterpret_cast expression. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStaticCastExpr > | cxxStaticCastExpr |
Matches a C++ static_cast expression. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDynamicCastExpr > | cxxDynamicCastExpr |
Matches a dynamic_cast expression. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstCastExpr > | cxxConstCastExpr |
Matches a const_cast expression. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CStyleCastExpr > | cStyleCastExpr |
Matches a C-style cast expression. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > | explicitCastExpr |
Matches explicit cast expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > | implicitCastExpr |
Matches the implicit cast nodes of Clang's AST. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > | castExpr |
Matches any cast nodes of Clang's AST. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFunctionalCastExpr > | cxxFunctionalCastExpr |
Matches functional cast expressions. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTemporaryObjectExpr > | cxxTemporaryObjectExpr |
Matches functional cast expressions having N != 1 arguments. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, PredefinedExpr > | predefinedExpr |
Matches predefined identifier expressions [C99 6.4.2.2]. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, DesignatedInitExpr > | designatedInitExpr |
Matches C99 designated initializer expressions [C99 6.7.8]. | |
const internal::VariadicAllOfMatcher< QualType > | qualType |
Matches QualTypes in the clang AST. | |
const internal::VariadicAllOfMatcher< Type > | type |
Matches Types in the clang AST. | |
const internal::VariadicAllOfMatcher< TypeLoc > | typeLoc |
Matches TypeLocs in the clang AST. | |
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> | eachOf = {internal::DynTypedMatcher::VO_EachOf} |
Matches if any of the given matchers matches. | |
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> | anyOf = {internal::DynTypedMatcher::VO_AnyOf} |
Matches if any of the given matchers matches. | |
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> | allOf = {internal::DynTypedMatcher::VO_AllOf} |
Matches if all given matchers match. | |
const internal::VariadicOperatorMatcherFunc< 1, 1 > | optionally |
Matches any node regardless of the submatcher. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > | unaryExprOrTypeTraitExpr |
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL) | |
const internal::MapAnyOfMatcher< BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator > | binaryOperation |
Matches nodes which can be used with binary operators. | |
const internal::MapAnyOfMatcher< CallExpr, CXXConstructExpr > | invocation |
Matches function calls and constructor calls. | |
const internal::VariadicFunction< internal::Matcher< NamedDecl >, StringRef, internal::hasAnyNameFunc > | hasAnyName = {} |
Matches NamedDecl nodes that have any of the specified names. | |
const internal::VariadicFunction< internal::PolymorphicMatcher< internal::HasOverloadedOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl), std::vector< std::string > >, StringRef, internal::hasAnyOverloadedOperatorNameFunc > | hasAnyOverloadedOperatorName = {} |
Matches overloaded operator names. | |
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > | has = {} |
Matches AST nodes that have child AST nodes that match the provided matcher. | |
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > | hasDescendant = {} |
Matches AST nodes that have descendant AST nodes that match the provided matcher. | |
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachMatcher > | forEach |
Matches AST nodes that have child AST nodes that match the provided matcher. | |
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > | forEachDescendant = {} |
Matches AST nodes that have descendant AST nodes that match the provided matcher. | |
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > | hasParent = {} |
Matches AST nodes that have a parent that matches the provided matcher. | |
const internal::ArgumentAdaptingMatcherFunc< internal::HasAncestorMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > | hasAncestor = {} |
Matches AST nodes that have an ancestor that matches the provided matcher. | |
const internal::VariadicOperatorMatcherFunc< 1, 1 > | unless |
Matches if the provided matcher does not match. | |
const internal::VariadicFunction< internal::Matcher< ObjCMessageExpr >, StringRef, internal::hasAnySelectorFunc > | hasAnySelector = {} |
Matches when at least one of the supplied string equals to the Selector.getAsString() | |
const internal::VariadicAllOfMatcher< LambdaCapture > | lambdaCapture |
Matches lambda captures. | |
const internal::VariadicFunction< internal::PolymorphicMatcher< internal::HasAnyOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, UnaryOperator), std::vector< std::string > >, StringRef, internal::hasAnyOperatorNameFunc > | hasAnyOperatorName = {} |
Matches operator expressions (binary or unary) that have any of the specified names. | |
const internal::VariadicDynCastAllOfMatcher< TypeLoc, QualifiedTypeLoc > | qualifiedTypeLoc |
Matches QualifiedTypeLoc s in the clang AST. | |
const internal::VariadicDynCastAllOfMatcher< TypeLoc, PointerTypeLoc > | pointerTypeLoc |
Matches pointer TypeLoc s. | |
const internal::VariadicDynCastAllOfMatcher< TypeLoc, ReferenceTypeLoc > | referenceTypeLoc |
Matches reference TypeLoc s. | |
const internal::VariadicDynCastAllOfMatcher< TypeLoc, TemplateSpecializationTypeLoc > | templateSpecializationTypeLoc |
Matches template specialization TypeLoc s. | |
const internal::VariadicDynCastAllOfMatcher< TypeLoc, ElaboratedTypeLoc > | elaboratedTypeLoc |
Matches C or C++ elaborated TypeLoc s. | |
const AstTypeMatcher< BuiltinType > | builtinType |
Matches builtin Types. | |
const AstTypeMatcher< ArrayType > | arrayType |
Matches all kinds of arrays. | |
const AstTypeMatcher< ComplexType > | complexType |
Matches C99 complex types. | |
const AstTypeMatcher< ConstantArrayType > | constantArrayType |
Matches C arrays with a specified constant size. | |
const AstTypeMatcher< DependentSizedArrayType > | dependentSizedArrayType |
Matches C++ arrays whose size is a value-dependent expression. | |
const AstTypeMatcher< DependentSizedExtVectorType > | dependentSizedExtVectorType |
Matches C++ extended vector type where either the type or size is dependent. | |
const AstTypeMatcher< IncompleteArrayType > | incompleteArrayType |
Matches C arrays with unspecified size. | |
const AstTypeMatcher< VariableArrayType > | variableArrayType |
Matches C arrays with a specified size that is not an integer-constant-expression. | |
const AstTypeMatcher< AtomicType > | atomicType |
Matches atomic types. | |
const AstTypeMatcher< AutoType > | autoType |
Matches types nodes representing C++11 auto types. | |
const AstTypeMatcher< DecltypeType > | decltypeType |
Matches types nodes representing C++11 decltype(<expr>) types. | |
const AstTypeMatcher< FunctionType > | functionType |
Matches FunctionType nodes. | |
const AstTypeMatcher< FunctionProtoType > | functionProtoType |
Matches FunctionProtoType nodes. | |
const AstTypeMatcher< ParenType > | parenType |
Matches ParenType nodes. | |
const AstTypeMatcher< BlockPointerType > | blockPointerType |
Matches block pointer types, i.e. | |
const AstTypeMatcher< MemberPointerType > | memberPointerType |
Matches member pointer types. | |
const AstTypeMatcher< PointerType > | pointerType |
Matches pointer types, but does not match Objective-C object pointer types. | |
const AstTypeMatcher< ObjCObjectPointerType > | objcObjectPointerType |
Matches an Objective-C object pointer type, which is different from a pointer type, despite being syntactically similar. | |
const AstTypeMatcher< ReferenceType > | referenceType |
Matches both lvalue and rvalue reference types. | |
const AstTypeMatcher< LValueReferenceType > | lValueReferenceType |
Matches lvalue reference types. | |
const AstTypeMatcher< RValueReferenceType > | rValueReferenceType |
Matches rvalue reference types. | |
const AstTypeMatcher< TypedefType > | typedefType |
Matches typedef types. | |
const AstTypeMatcher< MacroQualifiedType > | macroQualifiedType |
Matches qualified types when the qualifier is applied via a macro. | |
const AstTypeMatcher< EnumType > | enumType |
Matches enum types. | |
const AstTypeMatcher< TemplateSpecializationType > | templateSpecializationType |
Matches template specialization types. | |
const AstTypeMatcher< DeducedTemplateSpecializationType > | deducedTemplateSpecializationType |
Matches C++17 deduced template specialization types, e.g. | |
const AstTypeMatcher< UnaryTransformType > | unaryTransformType |
Matches types nodes representing unary type transformations. | |
const AstTypeMatcher< RecordType > | recordType |
Matches record types (e.g. | |
const AstTypeMatcher< TagType > | tagType |
Matches tag types (record and enum types). | |
const AstTypeMatcher< ElaboratedType > | elaboratedType |
Matches types specified with an elaborated type keyword or with a qualified name. | |
const AstTypeMatcher< UsingType > | usingType |
Matches types specified through a using declaration. | |
const AstTypeMatcher< SubstTemplateTypeParmType > | substTemplateTypeParmType |
Matches types that represent the result of substituting a type for a template type parameter. | |
const AstTypeMatcher< TemplateTypeParmType > | templateTypeParmType |
Matches template type parameter types. | |
const AstTypeMatcher< InjectedClassNameType > | injectedClassNameType |
Matches injected class name types. | |
const AstTypeMatcher< DecayedType > | decayedType |
Matches decayed type Example matches i[] in declaration of f. | |
const internal::VariadicAllOfMatcher< NestedNameSpecifier > | nestedNameSpecifier |
Matches nested name specifiers. | |
const internal::VariadicAllOfMatcher< NestedNameSpecifierLoc > | nestedNameSpecifierLoc |
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc . | |
const internal::VariadicAllOfMatcher< Attr > | attr |
Matches attributes. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > | cudaKernelCallExpr |
Matches CUDA kernel call expression. | |
const internal::VariadicDynCastAllOfMatcher< Stmt, OMPExecutableDirective > | ompExecutableDirective |
Matches any #pragma omp executable directive. | |
const internal::VariadicDynCastAllOfMatcher< OMPClause, OMPDefaultClause > | ompDefaultClause |
Matches OpenMP default clause. | |
using clang::ast_matchers::AstTypeMatcher = typedef internal::VariadicDynCastAllOfMatcher<Type, NodeType> |
Definition at line 7027 of file ASTMatchers.h.
using clang::ast_matchers::AttrMatcher = typedef internal::Matcher<Attr> |
Definition at line 154 of file ASTMatchers.h.
using clang::ast_matchers::CXXBaseSpecifierMatcher = typedef internal::Matcher<CXXBaseSpecifier> |
Definition at line 149 of file ASTMatchers.h.
using clang::ast_matchers::CXXCtorInitializerMatcher = typedef internal::Matcher<CXXCtorInitializer> |
Definition at line 150 of file ASTMatchers.h.
using clang::ast_matchers::DeclarationMatcher = typedef internal::Matcher<Decl> |
Types of matchers for the top-level classes in the AST class hierarchy.
Definition at line 143 of file ASTMatchers.h.
using clang::ast_matchers::LambdaCaptureMatcher = typedef internal::Matcher<LambdaCapture> |
Definition at line 153 of file ASTMatchers.h.
using clang::ast_matchers::NestedNameSpecifierLocMatcher = typedef internal::Matcher<NestedNameSpecifierLoc> |
Definition at line 148 of file ASTMatchers.h.
using clang::ast_matchers::NestedNameSpecifierMatcher = typedef internal::Matcher<NestedNameSpecifier> |
Definition at line 147 of file ASTMatchers.h.
using clang::ast_matchers::StatementMatcher = typedef internal::Matcher<Stmt> |
Definition at line 144 of file ASTMatchers.h.
using clang::ast_matchers::TemplateArgumentLocMatcher = typedef internal::Matcher<TemplateArgumentLoc> |
Definition at line 152 of file ASTMatchers.h.
using clang::ast_matchers::TemplateArgumentMatcher = typedef internal::Matcher<TemplateArgument> |
Definition at line 151 of file ASTMatchers.h.
using clang::ast_matchers::TypeLocMatcher = typedef internal::Matcher<TypeLoc> |
Definition at line 146 of file ASTMatchers.h.
using clang::ast_matchers::TypeMatcher = typedef internal::Matcher<QualType> |
Definition at line 145 of file ASTMatchers.h.
|
strong |
Gtest's comparison operations.
Enumerator | |
---|---|
Eq | |
Ne | |
Ge | |
Gt | |
Le | |
Lt |
Definition at line 25 of file GtestMatchers.h.
|
strong |
This enum indicates whether the mock method in the matched ON_CALL or EXPECT_CALL macro has arguments.
For example, None
can be used to match ON_CALL(mock, TwoParamMethod)
whereas Some
can be used to match ON_CALL(mock, TwoParamMethod(m1, m2))
.
Enumerator | |
---|---|
None | |
Some |
Definition at line 38 of file GtestMatchers.h.
|
inline |
Same as unaryExprOrTypeTraitExpr, but only matching alignof.
Definition at line 3060 of file ASTMatchers.h.
References allOf, anyOf, stmt, and unaryExprOrTypeTraitExpr.
|
inline |
Matches any node.
Useful when another matcher requires a child matcher, but there's no additional constraint. This will often be used with an explicit conversion to an internal::Matcher<>
type such as TypeMatcher
.
Example: DeclarationMatcher(anything())
matches all declarations, e.g.,
Usable as: Any Matcher
Definition at line 171 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER | ( | ArraySubscriptExpr | , |
isSafeArraySubscript | |||
) |
Definition at line 434 of file UnsafeBufferUsage.cpp.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CallExpr | , |
usesADL | |||
) |
Matches call expressions which were resolved using ADL.
Example matches y(x) but not y(42) or NS::y(x).
Definition at line 1510 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXCatchStmt | , |
isCatchAll | |||
) |
Matches a C++ catch statement that has a catch-all handler.
Given
cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
Definition at line 4760 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXConstructExpr | , |
isListInitialization | |||
) |
Matches a constructor call expression which uses list initialization.
Definition at line 4998 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXConstructExpr | , |
isSafeSpanTwoParamConstruct | |||
) |
Definition at line 365 of file UnsafeBufferUsage.cpp.
References clang::Expr::getIntegerConstantExpr(), clang::Stmt::getStmtClass(), clang::Expr::getType(), clang::Expr::IgnoreImplicit(), and Node.
clang::ast_matchers::AST_MATCHER | ( | CXXConstructExpr | , |
requiresZeroInitialization | |||
) |
Matches a constructor call expression which requires zero initialization.
Given
initListExpr(has(cxxConstructExpr(requiresZeroInitialization())) will match the implicit array filler for pt[1].
Definition at line 5014 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXConstructorDecl | , |
isCopyConstructor | |||
) |
Matches constructor declarations that are copy constructors.
Given
cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3.
Definition at line 7956 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXConstructorDecl | , |
isDefaultConstructor | |||
) |
Matches constructor declarations that are default constructors.
Given
cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3.
Definition at line 7986 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXConstructorDecl | , |
isDelegatingConstructor | |||
) |
Matches constructors that delegate to another constructor.
Given
cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not #1 or #2.
Definition at line 8003 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXConstructorDecl | , |
isInheritingConstructor | |||
) |
Definition at line 6354 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXConstructorDecl | , |
isMoveConstructor | |||
) |
Matches constructor declarations that are move constructors.
Given
cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2.
Definition at line 7971 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXCtorInitializer | , |
isBaseInitializer | |||
) |
Matches a constructor initializer if it is initializing a base, as opposed to a member.
Given
cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer())) will match E(), but not match D(int).
Definition at line 4859 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXCtorInitializer | , |
isMemberInitializer | |||
) |
Matches a constructor initializer if it is initializing a member, as opposed to a base.
Given
cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer())) will match D(int), but not match E().
Definition at line 4879 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXCtorInitializer | , |
isWritten | |||
) |
Matches a constructor initializer if it is explicitly written in code (as opposed to implicitly added by the compiler).
Given
cxxConstructorDecl(hasAnyConstructorInitializer(isWritten())) will match Foo(int), but not Foo()
Definition at line 4839 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXFoldExpr | , |
isBinaryFold | |||
) |
Matches binary fold expressions, i.e.
fold expressions with an initializer.
Example matches (0 + ... + args)
(matcher = cxxFoldExpr(isBinaryFold()))
Definition at line 4688 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXFoldExpr | , |
isLeftFold | |||
) |
Matches left-folding fold expressions.
Example matches (0 + ... + args)
(matcher = cxxFoldExpr(isLeftFold()))
Definition at line 4653 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXFoldExpr | , |
isRightFold | |||
) |
Matches right-folding fold expressions.
Example matches (args * ... * 1)
(matcher = cxxFoldExpr(isRightFold()))
Definition at line 4636 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXFoldExpr | , |
isUnaryFold | |||
) |
Matches unary fold expressions, i.e.
fold expressions without an initializer.
Example matches (args * ...)
(matcher = cxxFoldExpr(isUnaryFold()))
Definition at line 4671 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXMethodDecl | , |
isConst | |||
) |
Matches if the given method declaration is const.
Given
cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
Definition at line 6402 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXMethodDecl | , |
isCopyAssignmentOperator | |||
) |
Matches if the given method declaration declares a copy assignment operator.
Given
cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not the second one.
Definition at line 6419 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXMethodDecl | , |
isExplicitObjectMemberFunction | |||
) |
Matches if the given method declaration declares a member function with an explicit object parameter.
Given
cxxMethodDecl(isExplicitObjectMemberFunction()) matches the first two methods but not the last two.
Definition at line 5063 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXMethodDecl | , |
isMoveAssignmentOperator | |||
) |
Matches if the given method declaration declares a move assignment operator.
Given
cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not the first one.
Definition at line 6436 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXMethodDecl | , |
isOverride | |||
) |
Matches if the given method declaration overrides another method.
Given
matches B::x
Definition at line 6454 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXMethodDecl | , |
isPure | |||
) |
Matches if the given method declaration is pure.
Given
matches A::x
Definition at line 6389 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXMethodDecl | , |
isUserProvided | |||
) |
Matches method declarations that are user-provided.
Given
cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3.
Definition at line 6469 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXMethodDecl | , |
isVirtualAsWritten | |||
) |
Matches if the given method declaration has an explicit "virtual".
Given
matches A::x but not B::x
Definition at line 6350 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXNewExpr | , |
isArray | |||
) |
Matches array new expressions.
Given:
cxxNewExpr(isArray()) matches the expression 'new MyClass[10]'.
Definition at line 8475 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXRecordDecl | , |
hasDefinition | |||
) |
Matches a class declaration that is defined.
Example matches x (matcher = cxxRecordDecl(hasDefinition()))
Definition at line 8528 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | CXXRecordDecl | , |
isLambda | |||
) |
Matches the generated class of lambda expressions.
Given:
cxxRecordDecl(isLambda())
matches the implicit class declaration of decltype(x)
Definition at line 3468 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | Decl | , |
isInAnonymousNamespace | |||
) |
Matches declarations in an anonymous namespace.
Given
cxxRecordDecl(hasName("vector"), isInAnonymousNamespace()) will match #1, #2 and #3.
Definition at line 8152 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | Decl | , |
isInStdNamespace | |||
) |
Matches declarations in the namespace std
, but not in nested namespaces.
Given
cxxRecordDecl(hasName("vector"), isInStdNamespace()) will match only #1.
Definition at line 8130 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | EnumDecl | , |
isScoped | |||
) |
Matches C++11 scoped enum declaration.
Example matches Y (matcher = enumDecl(isScoped()))
Definition at line 8539 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | Expr | , |
isInstantiationDependent | |||
) |
Matches expressions that are instantiation-dependent even if it is neither type- nor value-dependent.
In the following example, the expression sizeof(sizeof(T() + T())) is instantiation-dependent (since it involves a template parameter T), but is neither type- nor value-dependent, since the type of the inner sizeof is known (std::size_t) and therefore the size of the outer sizeof is known.
expr(isInstantiationDependent()) matches sizeof(sizeof(T() + T())
Definition at line 1021 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | Expr | , |
isTypeDependent | |||
) |
Matches expressions that are type-dependent because the template type is not yet instantiated.
For example, the expressions "x" and "x + y" are type-dependent in the following code, but "y" is not type-dependent:
expr(isTypeDependent()) matches x + y
Definition at line 1037 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | Expr | , |
isValueDependent | |||
) |
Matches expression that are value-dependent because they contain a non-type template parameter.
For example, the array bound of "Chars" in the following example is value-dependent.
expr(isValueDependent()) matches return Size
Definition at line 1048 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | FieldDecl | , |
isBitField | |||
) |
Matches non-static data members that are bit-fields.
Given
fieldDecl(isBitField()) matches 'int a;' but not 'int b;'.
Definition at line 693 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | FunctionDecl | , |
hasTrailingReturn | |||
) |
Matches a function declared with a trailing return type.
Example matches Y (matcher = functionDecl(hasTrailingReturn()))
Definition at line 8550 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | FunctionDecl | , |
isDefaulted | |||
) |
Matches defaulted function declarations.
Given:
functionDecl(isDefaulted()) matches the declaration of ~B, but not ~A.
Definition at line 5454 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | FunctionDecl | , |
isDeleted | |||
) |
Matches deleted function declarations.
Given:
functionDecl(isDeleted()) matches the declaration of DeletedFunc, but not Func.
Definition at line 5441 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | FunctionDecl | , |
isMain | |||
) |
Determines whether the function is "main", which is the entry point into an executable program.
Definition at line 738 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | FunctionDecl | , |
isNoReturn | |||
) |
Matches FunctionDecls
that have a noreturn attribute.
Given
functionDecl(isNoReturn()) matches all of those except
Definition at line 5377 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | FunctionDecl | , |
isVariadic | |||
) |
Matches if a function declaration is variadic.
Example matches f, but not g or h. The function i will not match, even when compiled in C mode.
Definition at line 6239 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | FunctionDecl | , |
isWeak | |||
) |
Matches weak function declarations.
Given:
functionDecl(isWeak()) matches the weak declaration "foo", but not "bar".
Definition at line 5467 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | LambdaCapture | , |
capturesThis | |||
) |
Matches a LambdaCapture
that refers to 'this'.
Given
lambdaExpr(hasAnyCapture(lambdaCapture(capturesThis()))) matches [this]() { return cc; }
.
Definition at line 4995 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | NamedDecl | , |
hasExternalFormalLinkage | |||
) |
Matches a declaration that has external formal linkage.
Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
Example matches f() because it has external formal linkage despite being unique to the translation unit as though it has internal likage (matcher = functionDecl(hasExternalFormalLinkage()))
Definition at line 8438 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | NamespaceDecl | , |
isAnonymous | |||
) |
Matches anonymous namespace declarations.
Given
namespaceDecl(isAnonymous()) will match #1 but not ::n.
Definition at line 8105 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | ObjCMessageExpr | , |
hasKeywordSelector | |||
) |
Matches when the selector is a keyword selector.
objCMessageExpr(hasKeywordSelector()) matches the generated setFrame message expression in
Definition at line 3889 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | ObjCMessageExpr | , |
hasNullSelector | |||
) |
Matches when the selector is the empty selector.
Matches only when the selector of the objCMessageExpr is NULL. This may represent an error condition in the tree!
Definition at line 3861 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | ObjCMessageExpr | , |
hasUnarySelector | |||
) |
Matches when the selector is a Unary Selector.
matcher = objCMessageExpr(matchesSelector(hasUnarySelector()); matches self.bodyView in the code below, but NOT the outer message invocation of "loadHTMLString:baseURL:".
Definition at line 3873 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | ObjCMessageExpr | , |
isClassMessage | |||
) |
Returns true when the Objective-C message is sent to a class.
Example matcher = objcMessageExpr(isClassMessage()) matches
but not
Definition at line 3778 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | ObjCMessageExpr | , |
isInstanceMessage | |||
) |
Returns true when the Objective-C message is sent to an instance.
Example matcher = objcMessageExpr(isInstanceMessage()) matches
but not
Definition at line 3795 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | ObjCMethodDecl | , |
isClassMethod | |||
) |
Returns true when the Objective-C method declaration is a class method.
Example matcher = objcMethodDecl(isClassMethod()) matches
but not
Definition at line 3745 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | ObjCMethodDecl | , |
isInstanceMethod | |||
) |
Returns true when the Objective-C method declaration is an instance method.
Example matcher = objcMethodDecl(isInstanceMethod()) matches
but not
Definition at line 3761 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | OMPDefaultClause | , |
isFirstPrivateKind | |||
) |
Matches if the OpenMP default
clause has firstprivate
kind specified.
Given
ompDefaultClause(isFirstPrivateKind())
matches only default(firstprivate)
.
Definition at line 8764 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | OMPDefaultClause | , |
isNoneKind | |||
) |
Matches if the OpenMP default
clause has none
kind specified.
Given
ompDefaultClause(isNoneKind())
matches only default(none)
.
Definition at line 8709 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | OMPDefaultClause | , |
isPrivateKind | |||
) |
Matches if the OpenMP default
clause has private
kind specified.
Given
ompDefaultClause(isPrivateKind())
matches only default(private)
.
Definition at line 8745 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | OMPDefaultClause | , |
isSharedKind | |||
) |
Matches if the OpenMP default
clause has shared
kind specified.
Given
ompDefaultClause(isSharedKind())
matches only default(shared)
.
Definition at line 8726 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | OMPExecutableDirective | , |
isStandaloneDirective | |||
) |
Matches standalone OpenMP directives, i.e., directives that can't have a structured block.
Given
ompExecutableDirective(isStandaloneDirective()))
matches omp taskyield
.
Definition at line 8634 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | ParmVarDecl | , |
hasDefaultArgument | |||
) |
Matches a declaration that has default arguments.
Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
Deprecated. Use hasInitializer() instead to be able to match on the contents of the default argument. For example:
parmVarDecl(hasInitializer(integerLiteral(equals(42)))) matches the parameter of y
A matcher such as parmVarDecl(hasInitializer(anything())) is equivalent to parmVarDecl(hasDefaultArgument()).
Definition at line 8463 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | QualType | , |
hasLocalQualifiers | |||
) |
Matches QualType nodes that have local CV-qualifiers attached to the node, not hidden within a typedef.
Given
varDecl
(hasType(hasLocalQualifiers())) matches only j
and k
. i
is const-qualified but the qualifier is not local.
Definition at line 6630 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | QualType | , |
isAnyCharacter | |||
) |
clang::ast_matchers::AST_MATCHER | ( | QualType | , |
isAnyPointer | |||
) |
Matches QualType nodes that are of any pointer type; this includes the Objective-C object pointer type, which is different despite being syntactically similar.
Given
varDecl(hasType(isAnyPointer())) matches "int *i" and "Foo *f", but not "int j".
Definition at line 6575 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | QualType | , |
isConstQualified | |||
) |
Matches QualType nodes that are const-qualified, i.e., that include "top-level" const.
Given
functionDecl(hasAnyParameter(hasType(isConstQualified()))) matches "void b(int const)", "void c(const int)" and "void e(int const) {}". It does not match d as there is no top-level const on the parameter type "const int *".
Definition at line 6594 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | QualType | , |
isInteger | |||
) |
clang::ast_matchers::AST_MATCHER | ( | QualType | , |
isSignedInteger | |||
) |
clang::ast_matchers::AST_MATCHER | ( | QualType | , |
isUnsignedInteger | |||
) |
Matches QualType nodes that are of unsigned integer type.
Given
functionDecl(hasAnyParameter(hasType(isUnsignedInteger()))) matches "b(unsigned long)", but not "a(int)" and "c(double)".
Definition at line 6527 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | QualType | , |
isVolatileQualified | |||
) |
Matches QualType nodes that are volatile-qualified, i.e., that include "top-level" volatile.
Given
functionDecl(hasAnyParameter(hasType(isVolatileQualified()))) matches "void b(int volatile)", "void c(volatile int)" and "void e(int volatile) {}". It does not match d as there is no top-level volatile on the parameter type "volatile int *".
Definition at line 6613 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | TagDecl | , |
isClass | |||
) |
clang::ast_matchers::AST_MATCHER | ( | TagDecl | , |
isEnum | |||
) |
clang::ast_matchers::AST_MATCHER | ( | TagDecl | , |
isStruct | |||
) |
clang::ast_matchers::AST_MATCHER | ( | TagDecl | , |
isUnion | |||
) |
clang::ast_matchers::AST_MATCHER | ( | TemplateArgument | , |
isIntegral | |||
) |
Matches a TemplateArgument that is an integral value.
Given
classTemplateSpecializationDecl( hasAnyTemplateArgument(isIntegral())) matches the implicit instantiation of C in C<42> with isIntegral() matching 42.
Definition at line 1184 of file ASTMatchers.h.
References clang::TemplateArgument::Integral, and Node.
clang::ast_matchers::AST_MATCHER | ( | Type | , |
booleanType | |||
) |
Matches type bool
.
Given
functionDecl(returns(booleanType())) matches "bool func();"
Definition at line 7010 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | Type | , |
realFloatingPointType | |||
) |
Matches any real floating-point type (float, double, long double).
Given
realFloatingPointType() matches "float f" but not "int i"
Definition at line 7074 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | Type | , |
voidType | |||
) |
Matches type void
.
Given
functionDecl(returns(voidType())) matches "void func();"
Definition at line 7022 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | UnaryOperator | , |
isPreInc | |||
) |
Definition at line 264 of file UnsafeBufferUsage.cpp.
References Node.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
hasAutomaticStorageDuration | |||
) |
Matches a variable declaration that has automatic storage duration.
Example matches x, but not y, z, or a. (matcher = varDecl(hasAutomaticStorageDuration())
Definition at line 4450 of file ASTMatchers.h.
References Node, and clang::SD_Automatic.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
hasGlobalStorage | |||
) |
Matches a variable declaration that does not have local storage.
Example matches y and z (matcher = varDecl(hasGlobalStorage())
Definition at line 4434 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
hasLocalStorage | |||
) |
Matches a variable declaration that has function scope and is a non-static local variable.
Example matches x (matcher = varDecl(hasLocalStorage())
Definition at line 4420 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
hasStaticStorageDuration | |||
) |
Matches a variable declaration that has static storage duration.
It includes the variable declared at namespace scope and those declared with "static" and "extern" storage class specifiers.
Definition at line 4470 of file ASTMatchers.h.
References Node, and clang::SD_Static.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
hasThreadStorageDuration | |||
) |
Matches a variable declaration that has thread storage duration.
Example matches z, but not x, z, or a. (matcher = varDecl(hasThreadStorageDuration())
Definition at line 4486 of file ASTMatchers.h.
References Node, and clang::SD_Thread.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
isConstinit | |||
) |
Matches constinit variable declarations.
Given:
varDecl(isConstinit()) matches the declaration of foo
and bar
, but not baz
and xyz
.
Definition at line 5574 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
isExceptionVariable | |||
) |
Matches a variable declaration that is an exception variable from a C++ catch block, or an Objective-C @catch statement.
Example matches x (matcher = varDecl(isExceptionVariable())
Definition at line 4501 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
isInitCapture | |||
) |
Matches a variable serving as the implicit variable for a lambda init- capture.
Example matches x (matcher = varDecl(isInitCapture()))
Definition at line 4363 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER | ( | VarDecl | , |
isStaticLocal | |||
) |
Matches a static variable with local scope.
Example matches y (matcher = varDecl(isStaticLocal()))
Definition at line 4405 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_FUNCTION | ( | internal::Matcher< Decl > | , |
isInstantiated | |||
) |
Matches declarations that are template instantiations or are inside template instantiations.
Given
functionDecl(isInstantiated()) matches 'A(int) {...};' and 'A(unsigned) {...}'.
Definition at line 6762 of file ASTMatchers.h.
References anyOf, cxxRecordDecl, decl, functionDecl, hasAncestor, clang::isTemplateInstantiation(), and varDecl.
clang::ast_matchers::AST_MATCHER_FUNCTION | ( | internal::Matcher< Expr > | , |
nullPointerConstant | |||
) |
Matches expressions that resolve to a null pointer constant, such as GNU's __null, C++11's nullptr, or C's NULL macro.
Given:
expr(nullPointerConstant()) matches the initializer for v1, v2, v3, cp, and ip. Does not match the initializer for i.
Definition at line 8231 of file ASTMatchers.h.
References anyOf, cxxNullPtrLiteralExpr, equals(), expr, gnuNullExpr, hasParent, integerLiteral, and pointerType.
clang::ast_matchers::AST_MATCHER_FUNCTION | ( | internal::Matcher< Stmt > | , |
isInTemplateInstantiation | |||
) |
Matches statements inside of a template instantiation.
Given
declStmt(isInTemplateInstantiation()) matches 'int i;' and 'unsigned i'. unless(stmt(isInTemplateInstantiation())) will NOT match j += 42; as it's shared between the template definition and instantiation.
Definition at line 6783 of file ASTMatchers.h.
References anyOf, cxxRecordDecl, decl, functionDecl, hasAncestor, clang::isTemplateInstantiation(), stmt, and varDecl.
clang::ast_matchers::AST_MATCHER_FUNCTION_P_OVERLOAD | ( | internal::BindableMatcher< NestedNameSpecifierLoc > | , |
loc | , | ||
internal::Matcher< NestedNameSpecifier > | , | ||
InnerMatcher | , | ||
1 | |||
) |
Matches NestedNameSpecifierLocs
for which the given inner NestedNameSpecifier-matcher matches.
Definition at line 7746 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_FUNCTION_P_OVERLOAD | ( | internal::BindableMatcher< TypeLoc > | , |
loc | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | , | ||
0 | |||
) |
Matches TypeLocs
for which the given inner QualType-matcher matches.
Definition at line 6809 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_P | ( | AbstractConditionalOperator | , |
hasFalseExpression | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the false branch expression of a conditional operator (binary or ternary).
Example matches b
Definition at line 6195 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | AbstractConditionalOperator | , |
hasTrueExpression | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the true branch expression of a conditional operator.
Example 1 (conditional ternary operator): matches a
Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
Definition at line 6180 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ArraySubscriptExpr | , |
hasBase | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the base expression of an array subscript expression.
Given
arraySubscriptExpression(hasBase(implicitCastExpr( hasSourceExpression(declRefExpr())))) matches i
[1] with the declRefExpr()
matching i
Definition at line 5729 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ArraySubscriptExpr | , |
hasIndex | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the index expression of an array subscript expression.
Given
arraySubscriptExpression(hasIndex(integerLiteral())) matches i
[1] with the integerLiteral()
matching 1
Definition at line 5712 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | BaseUsingDecl | , |
hasAnyUsingShadowDecl | , | ||
internal::Matcher< UsingShadowDecl > | , | ||
InnerMatcher | |||
) |
Matches any using shadow declaration.
Given
usingDecl(hasAnyUsingShadowDecl(hasName("b")))) matches
Definition at line 6690 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | BindingDecl | , |
forDecomposition | , | ||
internal::Matcher< ValueDecl > | , | ||
InnerMatcher | |||
) |
Matches the DecompositionDecl the binding belongs to.
For example, in:
The matcher:
matches 'f' in 'auto &[f, s, t]'.
Definition at line 8255 of file ASTMatchers.h.
References Node.
Definition at line 464 of file UnsafeBufferUsage.cpp.
References Node, and clang::Num.
clang::ast_matchers::AST_MATCHER_P | ( | CaseStmt | , |
hasCaseConstant | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
If the given case statement does not use the GNU case range extension, matches the constant given in the statement.
Given
caseStmt(hasCaseConstant(integerLiteral())) matches "case 1:"
Definition at line 8165 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CastExpr | , |
castSubExpr | , | ||
internal::Matcher< Expr > | , | ||
innerMatcher | |||
) |
Definition at line 259 of file UnsafeBufferUsage.cpp.
References Node.
Matches casts that has a given cast kind.
Example: matches the implicit cast around 0
(matcher = castExpr(hasCastKind(CK_NullToPointer)))
If the matcher is use from clang-query, CastKind parameter should be passed as a quoted string. e.g., hasCastKind("CK_NullToPointer").
Definition at line 6096 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_P | ( | ClassTemplateSpecializationDecl | , |
hasSpecializedTemplate | , | ||
internal::Matcher< ClassTemplateDecl > | , | ||
InnerMatcher | |||
) |
Matches the specialized template of a specialization declaration.
Given
classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl())) matches '#2' with classTemplateDecl() matching the class template declaration of 'A' at #1.
Definition at line 752 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CompoundStmt | , |
statementCountIs | , | ||
unsigned | , | ||
N | |||
) |
Checks that a compound statement contains a specific number of child statements.
Example: Given
compoundStmt(statementCountIs(0))) matches '{}' but does not match the outer compound statement.
Definition at line 5827 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXConstructorDecl | , |
forEachConstructorInitializer | , | ||
internal::Matcher< CXXCtorInitializer > | , | ||
InnerMatcher | |||
) |
Matches each constructor initializer in a constructor definition.
Given
cxxConstructorDecl(forEachConstructorInitializer( forField(decl().bind("x")) )) will trigger two matches, binding for 'i' and 'j' respectively.
Definition at line 7928 of file ASTMatchers.h.
References Node, and clang::Result.
clang::ast_matchers::AST_MATCHER_P | ( | CXXConstructorDecl | , |
hasAnyConstructorInitializer | , | ||
internal::Matcher< CXXCtorInitializer > | , | ||
InnerMatcher | |||
) |
Matches a constructor initializer.
Given
cxxRecordDecl(has(cxxConstructorDecl( hasAnyConstructorInitializer(anything()) ))) record matches Foo, hasAnyConstructorInitializer matches foo_(1)
Definition at line 4777 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXCtorInitializer | , |
forField | , | ||
internal::Matcher< FieldDecl > | , | ||
InnerMatcher | |||
) |
Matches the field declaration of a constructor initializer.
Given
cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer( forField(hasName("foo_")))))) matches Foo with forField matching foo_
Definition at line 4799 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXCtorInitializer | , |
withInitializer | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the initializer expression of a constructor initializer.
Given
cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer( withInitializer(integerLiteral(equals(1))))))) matches Foo with withInitializer matching (1)
Definition at line 4819 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXDependentScopeMemberExpr | , |
hasMemberName | , | ||
std::string | , | ||
N | |||
) |
Matches template-dependent, but known, member names.
In template declarations, dependent members are not resolved and so can not be matched to particular named declarations.
This matcher allows to match on the known name of members.
Given
cxxDependentScopeMemberExpr
(hasMemberName("mem")) matches s.mem()
Definition at line 3196 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXDependentScopeMemberExpr | , |
memberHasSameNameAsBoundNode | , | ||
std::string | , | ||
BindingID | |||
) |
Matches template-dependent, but known, member names against an already-bound node.
In template declarations, dependent members are not resolved and so can not be matched to particular named declarations.
This matcher allows to match on the name of already-bound VarDecl, FieldDecl and CXXMethodDecl nodes.
Given
The matcher
first matches and binds the mem
member of the S
template, then compares its name to the usage in s.mem()
in the x
function template
Definition at line 3234 of file ASTMatchers.h.
References clang::DynTypedNode::get(), Node, and Nodes.
clang::ast_matchers::AST_MATCHER_P | ( | CXXFoldExpr | , |
hasFoldInit | , | ||
internal::Matcher< Expr > | , | ||
InnerMacher | |||
) |
Matches the operand that does not contain the parameter pack.
Example matches (0 + ... + args)
and (args * ... * 1)
(matcher = cxxFoldExpr(hasFoldInit(expr()))) with hasFoldInit(...) matching 0
and 1
respectively
Definition at line 4594 of file ASTMatchers.h.
References clang::Init, and Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXFoldExpr | , |
hasPattern | , | ||
internal::Matcher< Expr > | , | ||
InnerMacher | |||
) |
Matches the operand that contains the parameter pack.
Example matches (0 + ... + args)
(matcher = cxxFoldExpr(hasPattern(expr()))) with hasPattern(...) matching args
Definition at line 4616 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXForRangeStmt | , |
hasLoopVariable | , | ||
internal::Matcher< VarDecl > | , | ||
InnerMatcher | |||
) |
Matches the initialization statement of a for loop.
Example: forStmt(hasLoopVariable(anything())) matches 'int x' in
Definition at line 2214 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXForRangeStmt | , |
hasRangeInit | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the range initialization statement of a for loop.
Example: forStmt(hasRangeInit(anything())) matches 'a' in
Definition at line 2228 of file ASTMatchers.h.
References clang::Init, and Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXMemberCallExpr | , |
on | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches on the implicit object argument of a member call expression, after stripping off any parentheses or implicit casts.
Given
cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y"))))) matches y.m()
and (g()).m()
. cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X"))))) matches x.m()
. cxxMemberCallExpr(on(callExpr())) matches (g()).m()
.
FIXME: Overload to allow directly matching types?
Definition at line 3708 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXMemberCallExpr | , |
onImplicitObjectArgument | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches on the implicit object argument of a member call expression.
Unlike on
, matches the argument directly without stripping away anything.
Given
cxxMemberCallExpr(onImplicitObjectArgument(hasType( cxxRecordDecl(hasName("Y"))))) matches y.m()
, x.m()
and (g()).m()
, but not x.g()
). cxxMemberCallExpr(on(callExpr())) only matches (g()).m()
(the parens are ignored).
FIXME: Overload to allow directly matching types?
Definition at line 4216 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXMethodDecl | , |
forEachOverridden | , | ||
internal::Matcher< CXXMethodDecl > | , | ||
InnerMatcher | |||
) |
Matches each method overridden by the given method.
This matcher may produce multiple matches.
Given
cxxMethodDecl(ofClass(hasName("C")), forEachOverridden(cxxMethodDecl().bind("b"))).bind("d") matches once, with "b" binding "A::f" and "d" binding "C::f" (Note that B::f is not overridden by C::f).
The check can produce multiple matches in case of multiple inheritance, e.g.
cxxMethodDecl(ofClass(hasName("C")), forEachOverridden(cxxMethodDecl().bind("b"))).bind("d") matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and once with "b" binding "A2::f" and "d" binding "C::f".
Definition at line 6294 of file ASTMatchers.h.
References Node, and clang::Result.
clang::ast_matchers::AST_MATCHER_P | ( | CXXMethodDecl | , |
ofClass | , | ||
internal::Matcher< CXXRecordDecl > | , | ||
InnerMatcher | |||
) |
Matches the class declaration that the given method declaration belongs to.
FIXME: Generalize this for other kinds of declarations. FIXME: What other kind of declarations would we need to generalize this to?
Example matches A() in the last line (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl( ofClass(hasName("A"))))))
Definition at line 6260 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_P | ( | CXXNewExpr | , |
hasAnyPlacementArg | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches any placement new expression arguments.
Given:
cxxNewExpr(hasAnyPlacementArg(anything())) matches the expression 'new (Storage, 16) MyClass()'.
Definition at line 8501 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXNewExpr | , |
hasArraySize | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches array new expressions with a given array size.
Given:
cxxNewExpr(hasArraySize(integerLiteral(equals(10)))) matches the expression 'new MyClass[10]'.
Definition at line 8516 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXRecordDecl | , |
hasAnyBase | , | ||
internal::Matcher< CXXBaseSpecifier > | , | ||
BaseSpecMatcher | |||
) |
Matches C++ classes that have a direct or indirect base matching BaseSpecMatcher
.
Example: matcher hasAnyBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
Definition at line 3326 of file ASTMatchers.h.
References clang::ast_matchers::internal::matchesAnyBase(), and Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXRecordDecl | , |
hasDirectBase | , | ||
internal::Matcher< CXXBaseSpecifier > | , | ||
BaseSpecMatcher | |||
) |
Matches C++ classes that have a direct base matching BaseSpecMatcher
.
Example: matcher hasDirectBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
Definition at line 3343 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | CXXRecordDecl | , |
hasMethod | , | ||
internal::Matcher< CXXMethodDecl > | , | ||
InnerMatcher | |||
) |
Matches the first method of a class or struct that satisfies InnerMatcher
.
Given:
cxxRecordDecl
(hasMethod(hasName("func"))) matches the declaration of A
but not B
.
Definition at line 3445 of file ASTMatchers.h.
References Node, and clang::Result.
clang::ast_matchers::AST_MATCHER_P | ( | DecayedType | , |
hasDecayedType | , | ||
internal::Matcher< QualType > | , | ||
InnerType | |||
) |
Matches the decayed type, whoes decayed type matches InnerMatcher
.
Definition at line 7699 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Decl | , |
hasAttr | , | ||
attr::Kind | , | ||
AttrKind | |||
) |
Matches declaration that has a given attribute.
Given
decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of f. If the matcher is used from clang-query, attr::Kind parameter should be passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
Definition at line 8182 of file ASTMatchers.h.
References clang::Attr::getKind(), and Node.
clang::ast_matchers::AST_MATCHER_P | ( | Decl | , |
hasDeclContext | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | |||
) |
Matches declarations whose declaration context, interpreted as a Decl, matches InnerMatcher
.
Given
cxxRcordDecl
(hasDeclContext(namedDecl(hasName("M")))) matches the declaration of class
D
.
Definition at line 7718 of file ASTMatchers.h.
References clang::Decl::castFromDeclContext(), and Node.
clang::ast_matchers::AST_MATCHER_P | ( | DeclRefExpr | , |
to | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | |||
) |
Matches a DeclRefExpr that refers to a declaration that matches the specified matcher.
Example matches x in if(x) (matcher = declRefExpr(to(varDecl(hasName("x")))))
Definition at line 4263 of file ASTMatchers.h.
References Node.
Matches declaration statements that contain a specific number of declarations.
Example: Given
declCountIs(2) matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
Definition at line 4714 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | DecompositionDecl | , |
hasAnyBinding | , | ||
internal::Matcher< BindingDecl > | , | ||
InnerMatcher | |||
) |
Matches any binding of a DecompositionDecl.
For example, in:
The matcher:
matches the decomposition decl with 'f' bound to "fBinding".
Definition at line 8304 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | DesignatedInitExpr | , |
designatorCountIs | , | ||
unsigned | , | ||
N | |||
) |
Matches designated initializer expressions that contain a specific number of designators.
Example: Given
designatorCountIs(2) matches '{ [2].y = 1.0, [0].x = 1.0 }', but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'.
Definition at line 2797 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ElaboratedType | , |
hasQualifier | , | ||
internal::Matcher< NestedNameSpecifier > | , | ||
InnerMatcher | |||
) |
Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier, matches InnerMatcher
if the qualifier exists.
Given
elaboratedType
(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))) matches the type of the variable declaration of d
.
Definition at line 7594 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ElaboratedType | , |
namesType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches ElaboratedTypes whose named type matches InnerMatcher
.
Given
elaboratedType
(namesType(recordType( hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable declaration of d
.
Definition at line 7617 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ElaboratedTypeLoc | , |
hasNamedTypeLoc | , | ||
internal::Matcher< TypeLoc > | , | ||
InnerMatcher | |||
) |
clang::ast_matchers::AST_MATCHER_P | ( | ExplicitCastExpr | , |
hasDestinationType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches casts whose destination type matches a given matcher.
(Note: Clang's AST refers to other conversions as "casts" too, and calls actual casts "explicit" casts.)
Definition at line 6104 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Expr | , |
ignoringElidableConstructorCall | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches expressions that match InnerMatcher that are possibly wrapped in an elidable constructor and other corresponding bookkeeping nodes.
In C++17, elidable copy constructors are no longer being generated in the AST as it is not permitted by the standard. They are, however, part of the AST in C++14 and earlier. So, a matcher must abstract over these differences to work in all language modes. This matcher skips elidable constructor-call AST nodes, ExprWithCleanups
nodes wrapping elidable constructor-calls and various implicit nodes inside the constructor calls, all of which will not appear in the C++17 AST.
Given
varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())))
matches H D = G()
in C++11 through C++17 (and beyond).
Definition at line 8579 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_P | ( | Expr | , |
ignoringImpCasts | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches expressions that match InnerMatcher after any implicit casts are stripped off.
Parentheses and explicit casts are not discarded. Given
The matchers
would match the declarations for a, b, c, and d, but not e. While
only match the declarations for a.
Definition at line 923 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Expr | , |
ignoringImplicit | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches expressions that match InnerMatcher after any implicit AST nodes are stripped off.
Parentheses and explicit casts are not discarded. Given
The matchers
would match the declarations for a, b, and c. While
only match the declarations for b and c.
Definition at line 893 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Expr | , |
ignoringParenCasts | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches expressions that match InnerMatcher after parentheses and casts are stripped off.
Implicit and non-C Style casts are also discarded. Given
The matcher varDecl(hasInitializer(ignoringParenCasts(integerLiteral()))) would match the declarations for a, b, c, and d. while varDecl(hasInitializer(integerLiteral())) only match the declaration for a.
Definition at line 945 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Expr | , |
ignoringParenImpCasts | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches expressions that match InnerMatcher after implicit casts and parentheses are stripped off.
Explicit casts are not discarded. Given
The matchers varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral()))) varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr()))) would match the declarations for a, b, c, and d, but not e. while varDecl(hasInitializer(integerLiteral())) varDecl(hasInitializer(declRefExpr())) would only match the declaration for a.
Definition at line 970 of file ASTMatchers.h.
References Node.
Matches non-static data members that are bit-fields of the specified bit width.
Given
fieldDecl(hasBitWidth(2)) matches 'int a;' and 'int c;' but not 'int b;'.
Definition at line 710 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | FieldDecl | , |
hasInClassInitializer | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches non-static data members that have an in-class initializer.
Given
fieldDecl(hasInClassInitializer(integerLiteral(equals(2)))) matches 'int a;' but not 'int b;'. fieldDecl(hasInClassInitializer(anything())) matches 'int a;' and 'int b;' but not 'int c;'.
Definition at line 729 of file ASTMatchers.h.
References clang::Initializer, and Node.
clang::ast_matchers::AST_MATCHER_P | ( | ForStmt | , |
hasIncrement | , | ||
internal::Matcher< Stmt > | , | ||
InnerMatcher | |||
) |
Matches the increment statement of a for loop.
Example: forStmt(hasIncrement(unaryOperator(hasOperatorName("++")))) matches '++x' in
Definition at line 2175 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ForStmt | , |
hasLoopInit | , | ||
internal::Matcher< Stmt > | , | ||
InnerMatcher | |||
) |
Matches the initialization statement of a for loop.
Example: forStmt(hasLoopInit(declStmt())) matches 'int x = 0' in
Definition at line 2190 of file ASTMatchers.h.
References clang::Init, and Node.
clang::ast_matchers::AST_MATCHER_P | ( | FunctionDecl | , |
hasAnyBody | , | ||
internal::Matcher< Stmt > | , | ||
InnerMatcher | |||
) |
Matches a function declaration that has a given body present in the AST.
Note that this matcher matches all the declarations of a function whose body is present in the AST.
Given
functionDecl(hasAnyBody(compoundStmt())) matches both 'void f();' and 'void f() {}' with compoundStmt() matching '{}' but does not match 'void g();'
Definition at line 5788 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | FunctionDecl | , |
hasExplicitSpecifier | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the expression in an explicit specifier if present in the given declaration.
Given
cxxConstructorDecl(hasExplicitSpecifier(constantExpr())) will match #7, #8 and #9, but not #1 or #2. cxxConversionDecl(hasExplicitSpecifier(constantExpr())) will not match #3 or #4. cxxDeductionGuideDecl(hasExplicitSpecifier(constantExpr())) will not match #5 or #6.
Definition at line 8056 of file ASTMatchers.h.
References clang::ExplicitSpecifier::getExpr(), clang::ExplicitSpecifier::getFromDecl(), and Node.
clang::ast_matchers::AST_MATCHER_P | ( | FunctionDecl | , |
hasReturnTypeLoc | , | ||
internal::Matcher< TypeLoc > | , | ||
ReturnMatcher | |||
) |
Matches a function declared with the specified return TypeLoc
.
Given
functionDecl(hasReturnTypeLoc(loc(asString("int")))) matches the declaration of f
, but not g
.
Definition at line 6850 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_P | ( | FunctionDecl | , |
returns | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches the return type of a function declaration.
Given:
cxxMethodDecl(returns(asString("int"))) matches int f() { return 1; }
Definition at line 5387 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | IfStmt | , |
hasConditionVariableStatement | , | ||
internal::Matcher< DeclStmt > | , | ||
InnerMatcher | |||
) |
Matches the condition variable statement in an if statement.
Given
hasConditionVariableStatement(...) matches 'A* a = GetAPointer()'.
Definition at line 5695 of file ASTMatchers.h.
References Node.
Matches the else-statement of an if statement.
Examples matches the if statement (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
Definition at line 5645 of file ASTMatchers.h.
References Node.
Matches the then-statement of an if statement.
Examples matches the if statement (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
Definition at line 5633 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ImplicitCastExpr | , |
hasImplicitDestinationType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches implicit casts whose destination type matches a given matcher.
Definition at line 6112 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | InitListExpr | , |
hasSyntacticForm | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the syntactic form of init list expressions (if expression have it).
Definition at line 1716 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | LambdaCapture | , |
capturesVar | , | ||
internal::Matcher< ValueDecl > | , | ||
InnerMatcher | |||
) |
Matches a LambdaCapture
that refers to the specified VarDecl
.
The VarDecl
can be a separate variable that is captured by value or reference, or a synthesized variable if the capture has an initializer.
Given
In the matcher lambdaExpr(hasAnyCapture(lambdaCapture(capturesVar(hasName("x")))), capturesVar(hasName("x")) matches x
and x = 1
.
Definition at line 4973 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | LambdaExpr | , |
forEachLambdaCapture | , | ||
internal::Matcher< LambdaCapture > | , | ||
InnerMatcher | |||
) |
Matches each lambda capture in a lambda expression.
Given
lambdaExpr(forEachLambdaCapture( lambdaCapture(capturesVar(varDecl(hasType(isInteger())))))) will trigger two matches, binding for 'x' and 'y' respectively.
Definition at line 4378 of file ASTMatchers.h.
References Node, and clang::Result.
clang::ast_matchers::AST_MATCHER_P | ( | LambdaExpr | , |
hasAnyCapture | , | ||
internal::Matcher< LambdaCapture > | , | ||
InnerMatcher | |||
) |
Matches any capture in a lambda expression.
Given
lambdaExpr(hasAnyCapture(lambdaCapture())) and lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t"))))) both match [=](){ return t; }
.
Definition at line 4946 of file ASTMatchers.h.
References Node, and clang::Result.
clang::ast_matchers::AST_MATCHER_P | ( | MemberExpr | , |
member | , | ||
internal::Matcher< ValueDecl > | , | ||
InnerMatcher | |||
) |
Matches a member expression where the member is matched by a given matcher.
Given
memberExpr(member(hasName("first"))) matches second.first but not first.second (because the member name there is "second").
Definition at line 6646 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | NamedDecl | , |
hasUnderlyingDecl | , | ||
internal::Matcher< NamedDecl > | , | ||
InnerMatcher | |||
) |
Matches a NamedDecl
whose underlying declaration matches the given matcher.
Given
unresolvedLookupExpr
(hasAnyDeclaration( namedDecl(hasUnderlyingDecl(hasName("::N::f"))))) matches the use of f
in g()
.
Definition at line 3682 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | NestedNameSpecifier | , |
specifiesNamespace | , | ||
internal::Matcher< NamespaceDecl > | , | ||
InnerMatcher | |||
) |
Matches nested name specifiers that specify a namespace matching the given namespace matcher.
Given
nestedNameSpecifier(specifiesNamespace(hasName("ns"))) matches "ns::"
Definition at line 7836 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | NestedNameSpecifier | , |
specifiesType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches nested name specifiers that specify a type matching the given QualType
matcher without qualifiers.
Given
nestedNameSpecifier(specifiesType( hasDeclaration(cxxRecordDecl(hasName("A"))) )) matches "A::"
Definition at line 7766 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | NestedNameSpecifierLoc | , |
specifiesTypeLoc | , | ||
internal::Matcher< TypeLoc > | , | ||
InnerMatcher | |||
) |
Matches nested name specifier locs that specify a type matching the given TypeLoc
.
Given
nestedNameSpecifierLoc(specifiesTypeLoc(loc(type( hasDeclaration(cxxRecordDecl(hasName("A"))))))) matches "A::"
Definition at line 7784 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ObjCMessageExpr | , |
hasAnySelectorMatcher | , | ||
std::vector< std::string > | , | ||
Matches | |||
) |
Definition at line 46 of file ASTMatchersInternal.cpp.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ObjCMessageExpr | , |
hasReceiver | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches if the Objective-C message is sent to an instance, and the inner matcher matches on that instance.
For example the method call in
is matched by objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
Definition at line 3809 of file ASTMatchers.h.
References clang::Expr::IgnoreParenImpCasts(), and Node.
clang::ast_matchers::AST_MATCHER_P | ( | ObjCMessageExpr | , |
hasReceiverType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches on the receiver of an ObjectiveC Message expression.
Example matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *"))); matches the [webView ...] message invocation.
Definition at line 3727 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ObjCMessageExpr | , |
hasSelector | , | ||
std::string | , | ||
BaseName | |||
) |
Matches when BaseName == Selector.getAsString()
matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:")); matches the outer message expr in the code below, but NOT the message invocation for self.bodyView.
Definition at line 3825 of file ASTMatchers.h.
References clang::Selector::getAsString(), and Node.
clang::ast_matchers::AST_MATCHER_P | ( | ObjCMessageExpr | , |
numSelectorArgs | , | ||
unsigned | , | ||
N | |||
) |
Matches when the selector has the specified number of arguments.
matcher = objCMessageExpr(numSelectorArgs(0)); matches self.bodyView in the code below
matcher = objCMessageExpr(numSelectorArgs(2)); matches the invocation of "loadHTMLString:baseURL:" but not that of self.bodyView
Definition at line 3904 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | OMPExecutableDirective | , |
hasAnyClause | , | ||
internal::Matcher< OMPClause > | , | ||
InnerMatcher | |||
) |
Matches any clause in an OpenMP directive.
Given
ompExecutableDirective(hasAnyClause(anything()))
matches omp parallel default(none)
.
Definition at line 8671 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | OMPExecutableDirective | , |
hasStructuredBlock | , | ||
internal::Matcher< Stmt > | , | ||
InnerMatcher | |||
) |
Matches the structured-block of the OpenMP executable directive.
Prerequisite: the executable directive must not be standalone directive. If it is, it will never match.
Given
ompExecutableDirective(hasStructuredBlock(nullStmt()))
will match ;
Definition at line 8653 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | OMPExecutableDirective | , |
isAllowedToContainClauseKind | , | ||
OpenMPClauseKind | , | ||
CKind | |||
) |
Matches if the OpenMP directive is allowed to contain the specified OpenMP clause kind.
Given
ompExecutableDirective(isAllowedToContainClause(OMPC_default))
matches
omp parallel
and
omp parallel for
`.
If the matcher is use from clang-query, OpenMPClauseKind
parameter should be passed as a quoted string. e.g., isAllowedToContainClauseKind("OMPC_default").
Definition at line 8785 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | OverloadExpr | , |
hasAnyDeclaration | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | |||
) |
Matches an OverloadExpr
if any of the declarations in the set of overloads matches the given matcher.
Given
unresolvedLookupExpr(hasAnyDeclaration( functionTemplateDecl(hasName("foo")))) matches foo
in foo(t)
; but not bar
in bar(t)
;
Definition at line 4316 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ParmVarDecl | , |
isAtPosition | , | ||
unsigned | , | ||
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
parmVarDecl(isAtPosition(0))
matches int a
.
parmVarDecl(isAtPosition(1))
matches int b
.
Definition at line 5239 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | PointerTypeLoc | , |
hasPointeeLoc | , | ||
internal::Matcher< TypeLoc > | , | ||
PointeeMatcher | |||
) |
Matches pointer TypeLoc
s that have a pointee TypeLoc
matching PointeeMatcher
.
Given
pointerTypeLoc(hasPointeeLoc(loc(asString("int")))) matches int*
.
Definition at line 6876 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | QualifiedTypeLoc | , |
hasUnqualifiedLoc | , | ||
internal::Matcher< TypeLoc > | , | ||
InnerMatcher | |||
) |
Matches QualifiedTypeLoc
s that have an unqualified TypeLoc
matching InnerMatcher
.
Given
qualifiedTypeLoc(hasUnqualifiedLoc(pointerTypeLoc())) matches the TypeLoc
of the variable declaration of x
, but not y
.
Definition at line 6836 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | QualType | , |
asString | , | ||
std::string | , | ||
Name | |||
) |
Matches if the matched type is represented by the given string.
Given
cxxMemberCallExpr(on(hasType(asString("class Y *")))) matches y->x()
Definition at line 4110 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | QualType | , |
hasCanonicalType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches QualTypes whose canonical type matches InnerMatcher.
Given:
varDecl
(hasType(qualType(referenceType()))))) will not match the declaration of b but varDecl
(hasType(qualType(hasCanonicalType(referenceType())))))) does.
Definition at line 4185 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | QualType | , |
pointsTo | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches if the matched type is a pointer type and the pointee type matches the specified matcher.
Example matches y->x() (matcher = cxxMemberCallExpr(on(hasType(pointsTo cxxRecordDecl(hasName("Y")))))))
Definition at line 4124 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | QualType | , |
references | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches if the matched type is a reference type and the referenced type matches the specified matcher.
Example matches X &x and const X &y (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
Definition at line 4167 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ReferenceTypeLoc | , |
hasReferentLoc | , | ||
internal::Matcher< TypeLoc > | , | ||
ReferentMatcher | |||
) |
Matches reference TypeLoc
s that have a referent TypeLoc
matching ReferentMatcher
.
Given
referenceTypeLoc(hasReferentLoc(loc(asString("int")))) matches int&
.
Definition at line 6904 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | ReturnStmt | , |
hasReturnValue | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the return value expression of a return statement.
Given
hasReturnValue(binaryOperator()) matches 'return a + b' with binaryOperator() matching 'a + b'
Definition at line 8200 of file ASTMatchers.h.
References Node, and RetValue().
clang::ast_matchers::AST_MATCHER_P | ( | Stmt | , |
forCallable | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | |||
) |
Matches declaration of the function, method, or block the statement belongs to.
Given:
returnStmt(forCallable(functionDecl(hasName("operator=")))) matches 'return *this' but does not match 'return v > 0'
Given:
declStmt(forCallable(objcMethodDecl())) matches 'int x = 1' but does not match 'int y = 2'. whereas declStmt(forCallable(blockDecl())) matches 'int y = 2' but does not match 'int x = 1'.
Definition at line 8379 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Stmt | , |
forEachDescendantEvaluatedStmt | , | ||
internal::Matcher< Stmt > | , | ||
innerMatcher | |||
) |
Definition at line 223 of file UnsafeBufferUsage.cpp.
References clang::DynTypedNode::create(), clang::ast_matchers::MatchDescendantVisitor::findMatch(), and Node.
clang::ast_matchers::AST_MATCHER_P | ( | Stmt | , |
forEachDescendantStmt | , | ||
internal::Matcher< Stmt > | , | ||
innerMatcher | |||
) |
Definition at line 232 of file UnsafeBufferUsage.cpp.
References clang::DynTypedNode::create(), clang::ast_matchers::MatchDescendantVisitor::findMatch(), and Node.
clang::ast_matchers::AST_MATCHER_P | ( | Stmt | , |
forFunction | , | ||
internal::Matcher< FunctionDecl > | , | ||
InnerMatcher | |||
) |
Matches declaration of the function the statement belongs to.
Deprecated. Use forCallable() to correctly handle the situation when the declaration is not a function (but a block or an Objective-C method). forFunction() not only fails to take non-functions into account but also may match the wrong declaration in their presence.
Given:
returnStmt(forFunction(hasName("operator="))) matches 'return *this' but does not match 'return v > 0'
Definition at line 8328 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Stmt | , |
ignoreUnsafeBufferInContainer | , | ||
const UnsafeBufferUsageHandler * | , | ||
Handler | |||
) |
Definition at line 247 of file UnsafeBufferUsage.cpp.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Stmt | , |
ignoreUnsafeLibcCall | , | ||
const UnsafeBufferUsageHandler * | , | ||
Handler | |||
) |
Definition at line 252 of file UnsafeBufferUsage.cpp.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | Stmt | , |
notInSafeBufferOptOut | , | ||
const UnsafeBufferUsageHandler * | , | ||
Handler | |||
) |
Definition at line 242 of file UnsafeBufferUsage.cpp.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | StringLiteral | , |
mentionsBoundType | , | ||
std::string | , | ||
BindingID | |||
) |
Definition at line 39 of file OSObjectCStyleCast.cpp.
References clang::DynTypedNode::get(), Node, and Nodes.
clang::ast_matchers::AST_MATCHER_P | ( | SwitchStmt | , |
forEachSwitchCase | , | ||
internal::Matcher< SwitchCase > | , | ||
InnerMatcher | |||
) |
Matches each case or default statement belonging to the given switch statement.
This matcher may produce multiple matches.
Given
switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s") matches four times, with "c" binding each of "case 1:", "case 2:", "case 3:" and "case 4:", and "s" respectively binding "switch (1)", "switch (1)", "switch (2)" and "switch (2)".
Definition at line 7897 of file ASTMatchers.h.
References Node, and clang::Result.
clang::ast_matchers::AST_MATCHER_P | ( | TemplateArgument | , |
equalsIntegralValue | , | ||
std::string | , | ||
Value | |||
) |
Matches a TemplateArgument of integral type with a given value.
Note that 'Value' is a string as the template argument's value is an arbitrary precision integer. 'Value' must be euqal to the canonical representation of that integral value in base 10.
Given
classTemplateSpecializationDecl( hasAnyTemplateArgument(equalsIntegralValue("42"))) matches the implicit instantiation of C in C<42>.
Definition at line 1219 of file ASTMatchers.h.
References clang::TemplateArgument::Integral, Node, and toString().
clang::ast_matchers::AST_MATCHER_P | ( | TemplateArgument | , |
isExpr | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches a sugar TemplateArgument that refers to a certain expression.
Given
templateSpecializationType(hasAnyTemplateArgument( isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next")))))))) matches the specialization A<&B::next>
with fieldDecl(...)
matching B::next
Definition at line 1167 of file ASTMatchers.h.
References clang::TemplateArgument::Expression, and Node.
clang::ast_matchers::AST_MATCHER_P | ( | TemplateArgument | , |
refersToDeclaration | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | |||
) |
Matches a canonical TemplateArgument that refers to a certain declaration.
Given
classTemplateSpecializationDecl(hasAnyTemplateArgument( refersToDeclaration(fieldDecl(hasName("next"))))) matches the specialization A<&B::next>
with fieldDecl(...)
matching B::next
Definition at line 1148 of file ASTMatchers.h.
References clang::TemplateArgument::Declaration, and Node.
clang::ast_matchers::AST_MATCHER_P | ( | TemplateArgument | , |
refersToIntegralType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches a TemplateArgument that refers to an integral type.
Given
classTemplateSpecializationDecl( hasAnyTemplateArgument(refersToIntegralType(asString("int")))) matches the implicit instantiation of C in C<42>.
Definition at line 1198 of file ASTMatchers.h.
References clang::TemplateArgument::Integral, and Node.
clang::ast_matchers::AST_MATCHER_P | ( | TemplateArgument | , |
refersToTemplate | , | ||
internal::Matcher< TemplateName > | , | ||
InnerMatcher | |||
) |
Matches a TemplateArgument that refers to a certain template.
Given
classTemplateSpecializationDecl(hasAnyTemplateArgument( refersToTemplate(templateName()))) matches the specialization X<Y>
Definition at line 1128 of file ASTMatchers.h.
References Node, and clang::TemplateArgument::Template.
clang::ast_matchers::AST_MATCHER_P | ( | TemplateArgument | , |
refersToType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
Matches a TemplateArgument that refers to a certain type.
Given
classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType( recordType(hasDeclaration(recordDecl(hasName("X"))))))) matches the specialization of struct
A generated by A<X>
.
Definition at line 1110 of file ASTMatchers.h.
References Node, and clang::TemplateArgument::Type.
clang::ast_matchers::AST_MATCHER_P | ( | Type | , |
hasUnqualifiedDesugaredType | , | ||
internal::Matcher< Type > | , | ||
InnerMatcher | |||
) |
Matches if the matched type matches the unqualified desugared type of the matched node.
For example, in:
The matcher type(hasUnqualifiedDesugaredType(recordType())) matches both B and A.
Definition at line 4148 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | UnaryExprOrTypeTraitExpr | , |
hasArgumentOfType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | |||
) |
clang::ast_matchers::AST_MATCHER_P | ( | UnaryExprOrTypeTraitExpr | , |
ofKind | , | ||
UnaryExprOrTypeTrait | , | ||
Kind | |||
) |
Matches unary expressions of a certain kind.
Given
unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf)) matches sizeof(x)
If the matcher is use from clang-query, UnaryExprOrTypeTrait parameter should be passed as a quoted string. e.g., ofKind("UETT_SizeOf").
Definition at line 3054 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_P | ( | UsingShadowDecl | , |
hasTargetDecl | , | ||
internal::Matcher< NamedDecl > | , | ||
InnerMatcher | |||
) |
Matches a using shadow declaration where the target declaration is matched by the given matcher.
Given
usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl()))) matches
but not
Definition at line 6709 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P | ( | VarDecl | , |
hasInitializer | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches a variable declaration that has an initializer expression that matches the given matcher.
Example matches x (matcher = varDecl(hasInitializer(callExpr())))
Definition at line 4348 of file ASTMatchers.h.
References clang::Initializer, and Node.
clang::ast_matchers::AST_MATCHER_P | ( | VariableArrayType | , |
hasSizeExpr | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches VariableArrayType
nodes that have a specific size expression.
Given
variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to( varDecl(hasName("b"))))))) matches "int a[b]"
Definition at line 7198 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P2 | ( | CXXNewExpr | , |
hasPlacementArg | , | ||
unsigned | , | ||
Index | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches placement new expression arguments.
Given:
cxxNewExpr(hasPlacementArg(1, integerLiteral(equals(16)))) matches the expression 'new (Storage, 16) MyClass()'.
Definition at line 8487 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P2 | ( | DeclStmt | , |
containsDeclaration | , | ||
unsigned | , | ||
N | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | |||
) |
Matches the n'th declaration of a declaration statement.
Note that this does not work for global declarations because the AST breaks up multiple-declaration DeclStmt's into multiple single-declaration DeclStmt's. Example: Given non-global declarations
declStmt(containsDeclaration( 0, varDecl(hasInitializer(anything())))) matches only 'int d = 2, e;', and declStmt(containsDeclaration(1, varDecl()))
Definition at line 4737 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P2 | ( | DecompositionDecl | , |
hasBinding | , | ||
unsigned | , | ||
N | , | ||
internal::Matcher< BindingDecl > | , | ||
InnerMatcher | |||
) |
Matches the Nth binding of a DecompositionDecl.
For example, in:
The matcher:
matches the decomposition decl with 'f' bound to "fBinding".
Definition at line 8280 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P2 | ( | InitListExpr | , |
hasInit | , | ||
unsigned | , | ||
N | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the n'th item of an initializer list expression.
Example matches y. (matcher = initListExpr(hasInit(0, expr())))
Definition at line 4697 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P_OVERLOAD | ( | CXXMemberCallExpr | , |
thisPointerType | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | , | ||
1 | |||
) |
Overloaded to match the type's declaration.
Definition at line 4247 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_P_OVERLOAD | ( | CXXMemberCallExpr | , |
thisPointerType | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | , | ||
0 | |||
) |
Matches if the type of the expression's implicit object argument either matches the InnerMatcher, or is a pointer to a type that matches the InnerMatcher.
Given
cxxMemberCallExpr(thisPointerType(hasDeclaration( cxxRecordDecl(hasName("Y"))))) matches y.m()
, p->m()
and x.m()
. cxxMemberCallExpr(thisPointerType(hasDeclaration( cxxRecordDecl(hasName("X"))))) matches x.g()
.
Definition at line 4239 of file ASTMatchers.h.
Overloads for the equalsNode
matcher.
FIXME: Implement for other node types. Matches if a node equals another node.
Decl
has pointer identity in the AST.
Definition at line 7868 of file ASTMatchers.h.
References Node, and clang::Other.
clang::ast_matchers::AST_MATCHER_P_OVERLOAD | ( | Expr | , |
ignoringParens | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | , | ||
1 | |||
) |
Overload ignoringParens
for Expr
.
Given
The matcher
would match the implicit cast resulting from the assignment.
Definition at line 1002 of file ASTMatchers.h.
clang::ast_matchers::AST_MATCHER_P_OVERLOAD | ( | NestedNameSpecifier | , |
hasPrefix | , | ||
internal::Matcher< NestedNameSpecifier > | , | ||
InnerMatcher | , | ||
0 | |||
) |
Matches on the prefix of a NestedNameSpecifier
.
Given
nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and matches "A::"
Definition at line 7799 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P_OVERLOAD | ( | NestedNameSpecifierLoc | , |
hasPrefix | , | ||
internal::Matcher< NestedNameSpecifierLoc > | , | ||
InnerMatcher | , | ||
1 | |||
) |
Matches on the prefix of a NestedNameSpecifierLoc
.
Given
nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A"))))) matches "A::"
Definition at line 7817 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P_OVERLOAD | ( | QualType | , |
ignoringParens | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | , | ||
0 | |||
) |
Matches types that match InnerMatcher after any parens are stripped.
Given
The matcher
would match the declaration for fp.
Definition at line 986 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_P_OVERLOAD | ( | QualType | , |
pointsTo | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | , | ||
1 | |||
) |
Overloaded to match the pointee type's declaration.
Definition at line 4132 of file ASTMatchers.h.
References hasDeclaration(), Node, and qualType.
clang::ast_matchers::AST_MATCHER_P_OVERLOAD | ( | QualType | , |
references | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | , | ||
1 | |||
) |
Overloaded to match the referenced type's declaration.
Definition at line 4193 of file ASTMatchers.h.
References hasDeclaration(), Node, and qualType.
Matches if a node equals another node.
Stmt
has pointer identity in the AST.
Definition at line 7874 of file ASTMatchers.h.
References Node, and clang::Other.
Matches if a node equals another node.
Type
has pointer identity in the AST.
Definition at line 7880 of file ASTMatchers.h.
References Node, and clang::Other.
clang::ast_matchers::AST_MATCHER_REGEX | ( | NamedDecl | , |
matchesName | , | ||
RegExp | |||
) |
Matches NamedDecl nodes whose fully qualified names contain a substring matched by the given RegExp.
Supports specifying enclosing namespaces or classes by prefixing the name with '<enclosing>::'. Does not match typedefs of an underlying type with the given name.
Example matches X (regexp == "::X")
Example matches X (regexp is one of "::X", "^foo::.*X", among others)
Definition at line 3125 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_MATCHER_REGEX | ( | ObjCMessageExpr | , |
matchesSelector | , | ||
RegExp | |||
) |
Matches ObjC selectors whose name contains a substring matched by the given RegExp.
matcher = objCMessageExpr(matchesSelector("loadHTMLString\:baseURL?")); matches the outer message expr in the code below, but NOT the message invocation for self.bodyView.
Definition at line 3852 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | hasDynamicExceptionSpec | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, FunctionProtoType) | |||
) |
Matches functions that have a dynamic exception specification.
Given:
functionDecl(hasDynamicExceptionSpec()) and functionProtoType(hasDynamicExceptionSpec()) match the declarations of j, k, and l, but not f, g, h, or i.
Definition at line 5484 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isArrow | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(MemberExpr, UnresolvedMemberExpr, CXXDependentScopeMemberExpr) | |||
) |
Matches member expressions that are called with '->' as opposed to '.
'.
Member calls on the implicit this pointer match as called with '->'.
Given
memberExpr(isArrow()) matches this->x, x, y.x, a, this->b cxxDependentScopeMemberExpr(isArrow()) matches this->m unresolvedMemberExpr(isArrow()) matches this->f<T>, f<T>
Definition at line 6497 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isAssignmentOperator | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator) | |||
) |
Matches all kinds of assignment operators.
Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
Example 2: matches s1 = s2 (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
Definition at line 5949 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isComparisonOperator | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator) | |||
) |
Matches comparison operators.
Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
Example 2: matches s1 < s2 (matcher = cxxOperatorCallExpr(isComparisonOperator()))
Definition at line 5970 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isConsteval | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, IfStmt) | |||
) |
Matches consteval function declarations and if consteval/if ! consteval statements.
Given:
functionDecl(isConsteval()) matches the declaration of "int a()". ifStmt(isConsteval()) matches the if statement in "void b()", "void c()", "void d()".
Definition at line 5536 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isConstexpr | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(VarDecl, FunctionDecl, IfStmt) | |||
) |
Matches constexpr variable and function declarations, and if constexpr.
Given:
varDecl(isConstexpr()) matches the declaration of foo. functionDecl(isConstexpr()) matches the declaration of bar. ifStmt(isConstexpr()) matches the if statement in baz.
Definition at line 5556 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isDefinition | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(TagDecl, VarDecl, ObjCMethodDecl, FunctionDecl) | |||
) |
Matches if a declaration has a body attached.
Example matches A, va, fa
Usable as: Matcher<TagDecl>, Matcher<VarDecl>, Matcher<FunctionDecl>, Matcher<ObjCMethodDecl>
Definition at line 6222 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isExpansionInMainFile | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc) | |||
) |
Matches AST nodes that were expanded within the main-file.
Example matches X but not Y (matcher = cxxRecordDecl(isExpansionInMainFile())
Y.h:
Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
Definition at line 247 of file ASTMatchers.h.
References clang::SourceManager::getExpansionLoc(), clang::SourceManager::isInMainFile(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isExpansionInSystemHeader | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc) | |||
) |
Matches AST nodes that were expanded within system-header-files.
Example matches Y but not X (matcher = cxxRecordDecl(isExpansionInSystemHeader())
SystemHeader.h:
Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
Definition at line 268 of file ASTMatchers.h.
References clang::SourceManager::getExpansionLoc(), clang::SourceManager::isInSystemHeader(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isExplicit | , |
AST_POLYMORPHIC_SUPPORTED_TYPES( CXXConstructorDecl, CXXConversionDecl, CXXDeductionGuideDecl) | |||
) |
Matches constructor, conversion function, and deduction guide declarations that have an explicit specifier if this explicit specifier is resolved to true.
Given
cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9. cxxConversionDecl(isExplicit()) will match #4, but not #3. cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5.
Definition at line 8029 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isExplicitTemplateSpecialization | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl, CXXRecordDecl) | |||
) |
Matches explicit template specializations of function, class, or static member variable template instantiations.
Given
functionDecl(isExplicitTemplateSpecialization()) matches the specialization A<int>().
Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl>
Definition at line 6801 of file ASTMatchers.h.
References Node, and clang::TSK_ExplicitSpecialization.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isExternC | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl) | |||
) |
Matches extern "C" function or variable declarations.
Given:
functionDecl(isExternC()) matches the declaration of f and g, but not the declaration of h. varDecl(isExternC()) matches the declaration of x and y, but not the declaration of z.
Definition at line 5407 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isFinal | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, CXXMethodDecl) | |||
) |
Matches if the given method or class declaration is final.
Given:
matches A and C::f, but not B, C, or B::f
Definition at line 6373 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isImplicit | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Attr, LambdaCapture) | |||
) |
Matches an entity that has been implicitly added by the compiler (e.g.
implicit default/copy constructors).
Definition at line 761 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isInline | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(NamespaceDecl, FunctionDecl, VarDecl) | |||
) |
Matches functions, variables and namespace declarations that are marked with the inline keyword.
Given
functionDecl(isInline()) will match ::f(). namespaceDecl(isInline()) will match n::m. varDecl(isInline()) will match Foo;
Definition at line 8082 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isNoThrow | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, FunctionProtoType) | |||
) |
Matches functions that have a non-throwing exception specification.
Given:
functionDecl(isNoThrow()) and functionProtoType(isNoThrow()) match the declarations of g, and h, but not f, i or j.
Definition at line 5504 of file ASTMatchers.h.
References clang::FunctionProtoType::getExceptionSpecType(), clang::FunctionProtoType::isNothrow(), clang::isUnresolvedExceptionSpec(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isPrivate | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, CXXBaseSpecifier) | |||
) |
Matches private C++ declarations and C++ base specifers that specify private inheritance.
Examples:
Definition at line 676 of file ASTMatchers.h.
References clang::AS_private, and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isProtected | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, CXXBaseSpecifier) | |||
) |
Matches protected C++ declarations and C++ base specifers that specify protected inheritance.
Examples:
Definition at line 653 of file ASTMatchers.h.
References clang::AS_protected, and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isPublic | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, CXXBaseSpecifier) | |||
) |
Matches public C++ declarations and C++ base specifers that specify public inheritance.
Examples:
Definition at line 631 of file ASTMatchers.h.
References clang::AS_public, and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isStaticStorageClass | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl) | |||
) |
Matches variable/function declarations that have "static" storage class specifier ("static" keyword) written in the source.
Given:
functionDecl(isStaticStorageClass()) matches the function declaration f. varDecl(isStaticStorageClass()) matches the variable declaration i.
Definition at line 5426 of file ASTMatchers.h.
References Node, and clang::SC_Static.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isTemplateInstantiation | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl, CXXRecordDecl) | |||
) |
Matches template instantiations of function, class, or static member variable template instantiations.
Given
or
or
cxxRecordDecl(hasName("::X"), isTemplateInstantiation()) matches the template instantiation of X.
But given
cxxRecordDecl(hasName("::X"), isTemplateInstantiation()) does not match, as X is an explicit template specialization.
Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl>
Definition at line 6741 of file ASTMatchers.h.
References Node, clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ImplicitInstantiation.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER | ( | isVirtual | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CXXMethodDecl, CXXBaseSpecifier) | |||
) |
Matches declarations of virtual methods and C++ base specifers that specify virtual inheritance.
Example:
Example:
Usable as: Matcher<CXXMethodDecl>, Matcher<CXXBaseSpecifier>
Definition at line 6330 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | argumentCountAtLeast | , |
AST_POLYMORPHIC_SUPPORTED_TYPES( CallExpr, CXXConstructExpr, CXXUnresolvedConstructExpr, ObjCMessageExpr) | , | ||
unsigned | , | ||
N | |||
) |
Checks that a call expression or a constructor call expression has at least the specified number of arguments (including absent default arguments).
Example matches f(0, 0) and g(0, 0, 0) (matcher = callExpr(argumentCountAtLeast(2)))
Definition at line 4540 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | argumentCountIs | , |
AST_POLYMORPHIC_SUPPORTED_TYPES( CallExpr, CXXConstructExpr, CXXUnresolvedConstructExpr, ObjCMessageExpr) | , | ||
unsigned | , | ||
N | |||
) |
Checks that a call expression or a constructor call expression has a specific number of arguments (including absent default arguments).
Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
Definition at line 4513 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | equalsBoundNode | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Stmt, Decl, Type, QualType) | , | ||
std::string | , | ||
ID | |||
) |
Matches if a node equals a previously bound node.
Matches a node if it equals the node previously bound to ID
.
Given
cxxRecordDecl( has(fieldDecl(hasName("a"), hasType(type().bind("t")))), has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) matches the class X
, as a
and b
have the same type.
Note that when multiple matches are involved via forEach*
matchers, equalsBoundNodes
acts as a filter. For example: compoundStmt( forEachDescendant(varDecl().bind("d")), forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))) will trigger a match for each combination of variable declaration and reference to that variable declaration within a compound statement.
Definition at line 5671 of file ASTMatchers.h.
References clang::DynTypedNode::create(), ID, and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | forEachTemplateArgument | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, TemplateSpecializationType) | , | ||
internal::Matcher< TemplateArgument > | , | ||
InnerMatcher | |||
) |
Matches templateSpecializationType, class template specialization, variable template specialization, and function template specialization nodes where the template argument matches the inner matcher.
This matcher may produce multiple matches.
Given
templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) matches twice, with expr() matching 'R * 2' and 'R * 4' functionDecl(forEachTemplateArgument(refersToType(builtinType()))) matches the specialization f<unsigned, bool> twice, for 'unsigned' and 'bool'
Definition at line 5342 of file ASTMatchers.h.
References Node, and clang::Result.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasAnyArgument | , |
AST_POLYMORPHIC_SUPPORTED_TYPES( CallExpr, CXXConstructExpr, CXXUnresolvedConstructExpr, ObjCMessageExpr) | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches any argument of a call expression or a constructor call expression, or an ObjC-message-send expression.
Given
callExpr(hasAnyArgument(declRefExpr())) matches x(1, y, 42) with hasAnyArgument(...) matching y
For ObjectiveC, given
objcMessageExpr(hasAnyArgument(integerLiteral(equals(12)))) matches [i f:12]
Definition at line 4902 of file ASTMatchers.h.
References Node, and clang::Result.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasAnyParameter | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, ObjCMethodDecl, BlockDecl) | , | ||
internal::Matcher< ParmVarDecl > | , | ||
InnerMatcher | |||
) |
Matches any parameter of a function or an ObjC method declaration or a block.
Does not match the 'this' parameter of a method.
Given
cxxMethodDecl(hasAnyParameter(hasName("y"))) matches f(int x, int y, int z) {} with hasAnyParameter(...) matching int y
For ObjectiveC, given
the matcher objcMethodDecl(hasAnyParameter(hasName("y"))) matches the declaration of method f with hasParameter matching y.
For blocks, given
the matcher blockDecl(hasAnyParameter(hasName("y"))) matches the declaration of the block b with hasParameter matching y.
Definition at line 5283 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasAnySubstatement | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CompoundStmt, StmtExpr) | , | ||
internal::Matcher< Stmt > | , | ||
InnerMatcher | |||
) |
Matches compound statements where at least one substatement matches a given matcher.
Also matches StmtExprs that have CompoundStmt as children.
Given
hasAnySubstatement(compoundStmt()) matches '{ {}; 1+2; }' with compoundStmt() matching '{}'
Definition at line 5807 of file ASTMatchers.h.
References clang::CompoundStmt::body_begin(), clang::CompoundStmt::body_end(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasAnyTemplateArgument | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, TemplateSpecializationType) | , | ||
internal::Matcher< TemplateArgument > | , | ||
InnerMatcher | |||
) |
Matches templateSpecializationTypes, class template specializations, variable template specializations, and function template specializations that have at least one TemplateArgument matching the given InnerMatcher.
Given
classTemplateSpecializationDecl(hasAnyTemplateArgument( refersToType(asString("int")))) matches the specialization A<int>
functionDecl(hasAnyTemplateArgument(refersToType(asString("int")))) matches the specialization f<int>
Definition at line 788 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasAnyTemplateArgumentLoc | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, DeclRefExpr, TemplateSpecializationTypeLoc) | , | ||
internal::Matcher< TemplateArgumentLoc > | , | ||
InnerMatcher | |||
) |
Matches template specialization TypeLoc
s, class template specializations, variable template specializations, and function template specializations that have at least one TemplateArgumentLoc
matching the given InnerMatcher
.
Given
varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( hasTypeLoc(loc(asString("int"))))))) matches A<int> a
.
Definition at line 6935 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasBody | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(DoStmt, ForStmt, WhileStmt, CXXForRangeStmt, FunctionDecl, CoroutineBodyStmt) | , | ||
internal::Matcher< Stmt > | , | ||
InnerMatcher | |||
) |
Matches a 'for', 'while', 'while' statement or a function or coroutine definition that has a given body.
Note that in case of functions or coroutines this matcher only matches the definition itself and not the other declarations of the same function or coroutine.
Given
forStmt(hasBody(compoundStmt())) matches 'for (;;) {}' with compoundStmt() matching '{}'
Given
functionDecl(hasBody(compoundStmt())) matches 'void f() {}' with compoundStmt() matching '{}' but does not match 'void f();'
Definition at line 5760 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasCondition | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(IfStmt, ForStmt, WhileStmt, DoStmt, SwitchStmt, AbstractConditionalOperator) | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the condition expression of an if statement, for loop, switch statement or conditional operator.
Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
Definition at line 5616 of file ASTMatchers.h.
References clang::Condition, and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasEitherOperand | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXFoldExpr, CXXRewrittenBinaryOperator) | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches if either the left hand side or the right hand side of a binary operator or fold expression matches.
Definition at line 6013 of file ASTMatchers.h.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasInitStatement | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(IfStmt, SwitchStmt, CXXForRangeStmt) | , | ||
internal::Matcher< Stmt > | , | ||
InnerMatcher | |||
) |
Matches selection statements with initializer.
Given:
ifStmt(hasInitStatement(anything())) matches the if statement in foo but not in bar. switchStmt(hasInitStatement(anything())) matches the switch statement in foo but not in bar. cxxForRangeStmt(hasInitStatement(anything())) matches the range for statement in foo but not in bar.
Definition at line 5601 of file ASTMatchers.h.
References clang::Init, and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasLHS | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, ArraySubscriptExpr, CXXFoldExpr) | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the left hand side of binary operator expressions.
Example matches a (matcher = binaryOperator(hasLHS()))
Definition at line 5983 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasObjectExpression | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(MemberExpr, UnresolvedMemberExpr, CXXDependentScopeMemberExpr) | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches a member expression where the object expression is matched by a given matcher.
Implicit object expressions are included; that is, it matches use of implicit this
.
Given
memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X"))))) matches x.m
, but not m
; however, memberExpr(hasObjectExpression(hasType(pointsTo( matches m
(aka. this->m
), but not x.m
.
Definition at line 6667 of file ASTMatchers.h.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasOperatorName | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, CXXFoldExpr, UnaryOperator) | , | ||
std::string | , | ||
Name | |||
) |
Matches the operator Name of operator expressions and fold expressions (binary or unary).
Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
Example matches (0 + ... + args)
(matcher = cxxFoldExpr(hasOperatorName("+")))
Definition at line 5909 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasRHS | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator, ArraySubscriptExpr, CXXFoldExpr) | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the right hand side of binary operator expressions.
Example matches b (matcher = binaryOperator(hasRHS()))
Definition at line 6000 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasSize | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ConstantArrayType, StringLiteral) | , | ||
unsigned | , | ||
N | |||
) |
Matches nodes that have the specified size.
Given
constantArrayType(hasSize(42)) matches "int a[42]" and "int b[2 * 21]" stringLiteral(hasSize(4)) matches "abcd", L"abcd"
Definition at line 7124 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasSourceExpression | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CastExpr, OpaqueValueExpr) | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches if the cast's source expression or opaque value's source expression matches the given matcher.
Example 1: matches "a string" (matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
Example 2: matches 'b' (matcher = opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
Definition at line 6076 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasTypeLoc | , |
AST_POLYMORPHIC_SUPPORTED_TYPES( BlockDecl, CXXBaseSpecifier, CXXCtorInitializer, CXXFunctionalCastExpr, CXXNewExpr, CXXTemporaryObjectExpr, CXXUnresolvedConstructExpr, CompoundLiteralExpr, DeclaratorDecl, ExplicitCastExpr, ObjCPropertyDecl, TemplateArgumentLoc, TypedefNameDecl) | , | ||
internal::Matcher< TypeLoc > | , | ||
Inner | |||
) |
Matches if the type location of a node matches the inner matcher.
Examples:
declaratorDecl(hasTypeLoc(loc(asString("int")))) matches int x
cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int")))) matches int(3)
cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo")))) matches Foo(1, 2)
Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>, Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>, Matcher<CXXNewExpr>, Matcher<CXXTemporaryObjectExpr>, Matcher<CXXUnresolvedConstructExpr>, Matcher<CompoundLiteralExpr>, Matcher<DeclaratorDecl>, Matcher<ExplicitCastExpr>, Matcher<ObjCPropertyDecl>, Matcher<TemplateArgumentLoc>, Matcher<TypedefNameDecl>
Definition at line 4085 of file ASTMatchers.h.
References clang::TypeSourceInfo::getTypeLoc(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | hasUnaryOperand | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(UnaryOperator, CXXOperatorCallExpr) | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches if the operand of a unary operator matches.
Example matches true (matcher = hasUnaryOperand( cxxBoolLiteral(equals(true))))
Definition at line 6052 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | isDerivedFrom | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl) | , | ||
internal::Matcher< NamedDecl > | , | ||
Base | |||
) |
Matches C++ classes that are directly or indirectly derived from a class matching Base
, or Objective-C classes that directly or indirectly subclass a class matching Base
.
Note that a class is not considered to be derived from itself.
Example matches Y, Z, C (Base == hasName("X"))
In the following example, Bar matches isDerivedFrom(hasName("X")):
In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
Usable as: Matcher<CXXRecordDecl>, Matcher<ObjCInterfaceDecl>
Definition at line 3280 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | isExpandedFromMacro | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc) | , | ||
std::string | , | ||
MacroName | |||
) |
Matches statements that are (transitively) expanded from the named macro.
Does not match if only part of the statement is expanded from that macro or if different parts of the statement are expanded from different appearances of the macro.
Definition at line 316 of file ASTMatchers.h.
References E, clang::ast_matchers::internal::getExpansionLocOfMacro(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | parameterCountIs | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, FunctionProtoType) | , | ||
unsigned | , | ||
N | |||
) |
Matches FunctionDecls
and FunctionProtoTypes
that have a specific parameter count.
Given
functionDecl(parameterCountIs(2)) matches g
and h
functionProtoType(parameterCountIs(2)) matches g
and h
functionProtoType(parameterCountIs(3)) matches k
Definition at line 5311 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | templateArgumentCountIs | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, TemplateSpecializationType) | , | ||
unsigned | , | ||
N | |||
) |
Matches if the number of template arguments equals N
.
Given
classTemplateSpecializationDecl(templateArgumentCountIs(1)) matches C<int>.
Definition at line 1091 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P | ( | throughUsingDecl | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(DeclRefExpr, UsingType) | , | ||
internal::Matcher< UsingShadowDecl > | , | ||
Inner | |||
) |
Matches if a node refers to a declaration through a specific using shadow declaration.
Examples:
declRefExpr(throughUsingDecl(anything())) matches f
typeLoc(loc(usingType(throughUsingDecl(anything())))) matches X
Usable as: Matcher<DeclRefExpr>, Matcher<UsingType>
Definition at line 4291 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P2 | ( | forEachArgumentWithParam | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXConstructExpr) | , | ||
internal::Matcher< Expr > | , | ||
ArgMatcher | , | ||
internal::Matcher< ParmVarDecl > | , | ||
ParamMatcher | |||
) |
Matches all arguments and their respective ParmVarDecl.
Given
callExpr( forEachArgumentWithParam( declRefExpr(to(varDecl(hasName("y")))), parmVarDecl(hasType(isInteger())) )) matches f(y); with declRefExpr(...) matching int y and parmVarDecl(...) matching int i
Definition at line 5085 of file ASTMatchers.h.
References anyOf, callExpr, cxxConstructExpr, cxxConstructorDecl, cxxMethodDecl, cxxOperatorCallExpr, expr, functionDecl, hasDeclaration(), Node, clang::Result, and unless.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P2 | ( | forEachArgumentWithParamType | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXConstructExpr) | , | ||
internal::Matcher< Expr > | , | ||
ArgMatcher | , | ||
internal::Matcher< QualType > | , | ||
ParamMatcher | |||
) |
Matches all arguments and their respective types for a CallExpr
or CXXConstructExpr
.
It is very similar to forEachArgumentWithParam
but it works on calls through function pointers as well.
The difference is, that function pointers do not provide access to a ParmVarDecl
, but only the QualType
for each argument.
Given
callExpr( forEachArgumentWithParamType( declRefExpr(to(varDecl(hasName("y")))), qualType(isInteger()).bind("type) )) matches f(y) and f_ptr(y) with declRefExpr(...) matching int y and qualType(...) matching int
Definition at line 5148 of file ASTMatchers.h.
References anyOf, clang::Call, callExpr, cxxConstructExpr, cxxConstructorDecl, cxxMethodDecl, cxxOperatorCallExpr, expr, functionDecl, clang::Type::getAs(), clang::QualType::getCanonicalType(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::Type::getPointeeType(), clang::Value::getType(), hasDeclaration(), clang::Type::isFunctionPointerType(), clang::Type::isMemberFunctionPointerType(), clang::FunctionProtoType::isVariadic(), Node, clang::Result, and unless.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P2 | ( | hasArgument | , |
AST_POLYMORPHIC_SUPPORTED_TYPES( CallExpr, CXXConstructExpr, CXXUnresolvedConstructExpr, ObjCMessageExpr) | , | ||
unsigned | , | ||
N | , | ||
internal::Matcher< Expr > | , | ||
InnerMatcher | |||
) |
Matches the n'th argument of a call expression or a constructor call expression.
Example matches y in x(y) (matcher = callExpr(hasArgument(0, declRefExpr())))
Definition at line 4564 of file ASTMatchers.h.
References clang::Expr::IgnoreParenImpCasts(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P2 | ( | hasOperands | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(BinaryOperator, CXXOperatorCallExpr, CXXFoldExpr, CXXRewrittenBinaryOperator) | , | ||
internal::Matcher< Expr > | , | ||
Matcher1 | , | ||
internal::Matcher< Expr > | , | ||
Matcher2 | |||
) |
Matches if both matchers match with opposite sides of the binary operator or fold expression.
Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1), integerLiteral(equals(2)))
Definition at line 6034 of file ASTMatchers.h.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P2 | ( | hasParameter | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, ObjCMethodDecl, BlockDecl) | , | ||
unsigned | , | ||
N | , | ||
internal::Matcher< ParmVarDecl > | , | ||
InnerMatcher | |||
) |
Matches the n'th parameter of a function or an ObjC method declaration or a block.
Given
cxxMethodDecl(hasParameter(0, hasType(varDecl()))) matches f(int x) {} with hasParameter(...) matching int x
For ObjectiveC, given
the matcher objcMethodDecl(hasParameter(0, hasName("y"))) matches the declaration of method f with hasParameter matching y.
Definition at line 5038 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P2 | ( | hasTemplateArgument | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, TemplateSpecializationType) | , | ||
unsigned | , | ||
N | , | ||
internal::Matcher< TemplateArgument > | , | ||
InnerMatcher | |||
) |
Matches templateSpecializationType, class template specializations, variable template specializations, and function template specializations where the n'th TemplateArgument matches the given InnerMatcher.
Given
classTemplateSpecializationDecl(hasTemplateArgument( 1, refersToType(asString("int")))) matches the specialization A<bool, int>
functionDecl(hasTemplateArgument(0, refersToType(asString("int")))) matches the specialization f<int>
Definition at line 1069 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P2 | ( | hasTemplateArgumentLoc | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl, VarTemplateSpecializationDecl, FunctionDecl, DeclRefExpr, TemplateSpecializationTypeLoc) | , | ||
unsigned | , | ||
Index | , | ||
internal::Matcher< TemplateArgumentLoc > | , | ||
InnerMatcher | |||
) |
Matches template specialization TypeLoc
s, class template specializations, variable template specializations, and function template specializations where the n'th TemplateArgumentLoc
matches the given InnerMatcher
.
Given
varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, hasTypeLoc(loc(asString("double"))))))) matches A<double, int> b
, but not A<int, double> c
.
Definition at line 6960 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | callee | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr, CXXFoldExpr) | , | ||
internal::Matcher< Stmt > | , | ||
InnerMatcher | , | ||
0 | |||
) |
Matches if the call or fold expression's callee expression matches.
Given
callExpr(callee(expr())) matches this->x(), x(), y.x(), f() with callee(...) matching this->x, x, y.x, f respectively
Given
cxxFoldExpr(callee(expr())) matches (args * ... * 1) with callee(...) matching *
Note: Callee cannot take the more general internal::Matcher<Expr> because this introduces ambiguous overloads with calls to Callee taking a internal::Matcher<Decl>, as the matcher hierarchy is purely implemented in terms of implicit casts.
Definition at line 3941 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | callee | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ObjCMessageExpr, CallExpr) | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | , | ||
1 | |||
) |
Matches 1) if the call expression's callee's declaration matches the given matcher; or 2) if the Obj-C message expression's callee's method declaration matches the given matcher.
Example matches y.x() (matcher = callExpr(callee( cxxMethodDecl(hasName("x")))))
Example 2. Matches [I foo] with objcMessageExpr(callee(objcMethodDecl(hasName("foo"))))
Definition at line 3971 of file ASTMatchers.h.
References callExpr, hasDeclaration(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | equals | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CharacterLiteral, CXXBoolLiteralExpr, FloatingLiteral, IntegerLiteral) | , | ||
double | , | ||
Value | , | ||
2 | |||
) |
Definition at line 5883 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | equals | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CharacterLiteral, CXXBoolLiteralExpr, IntegerLiteral) | , | ||
bool | , | ||
Value | , | ||
0 | |||
) |
Definition at line 5865 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | equals | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CharacterLiteral, CXXBoolLiteralExpr, IntegerLiteral) | , | ||
unsigned | , | ||
Value | , | ||
1 | |||
) |
Definition at line 5874 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | hasType | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Expr, FriendDecl, TypedefNameDecl, ValueDecl, CXXBaseSpecifier) | , | ||
internal::Matcher< QualType > | , | ||
InnerMatcher | , | ||
0 | |||
) |
Matches if the expression's or declaration's type matches a type matcher.
Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X"))))) and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X"))))) and U (matcher = typedefDecl(hasType(asString("int"))) and friend class X (matcher = friendDecl(hasType("X")) and public virtual X (matcher = cxxBaseSpecifier(hasType( asString("class X")))
Definition at line 4003 of file ASTMatchers.h.
References clang::QualType::isNull(), and Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | hasType | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Expr, FriendDecl, ValueDecl, CXXBaseSpecifier, ObjCInterfaceDecl) | , | ||
internal::Matcher< Decl > | , | ||
InnerMatcher | , | ||
1 | |||
) |
Overloaded to match the declaration of the expression's or value declaration's type.
In case of a value declaration (for example a variable declaration), this resolves one layer of indirection. For example, in the value declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the declaration of x.
Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X"))))) and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X"))))) and friend class X (matcher = friendDecl(hasType("X")) and public virtual X (matcher = cxxBaseSpecifier(hasType( cxxRecordDecl(hasName("X"))))
Example matches class Derived (matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
Usable as: Matcher<Expr>, Matcher<FriendDecl>, Matcher<ValueDecl>, Matcher<CXXBaseSpecifier>
Definition at line 4044 of file ASTMatchers.h.
References hasDeclaration(), clang::QualType::isNull(), Node, and qualType.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | isDerivedFrom | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl) | , | ||
std::string | , | ||
BaseName | , | ||
1 | |||
) |
Overloaded method as shortcut for isDerivedFrom(hasName(...))
.
Definition at line 3295 of file ASTMatchers.h.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | isDirectlyDerivedFrom | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl) | , | ||
internal::Matcher< NamedDecl > | , | ||
Base | , | ||
0 | |||
) |
Matches C++ or Objective-C classes that are directly derived from a class matching Base
.
Note that a class is not considered to be derived from itself.
Example matches Y, C (Base == hasName("X"))
In the following example, Bar matches isDerivedFrom(hasName("X")):
Definition at line 3405 of file ASTMatchers.h.
References Node.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | isDirectlyDerivedFrom | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl) | , | ||
std::string | , | ||
BaseName | , | ||
1 | |||
) |
Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...))
.
Definition at line 3420 of file ASTMatchers.h.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | isSameOrDerivedFrom | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl) | , | ||
internal::Matcher< NamedDecl > | , | ||
Base | , | ||
0 | |||
) |
Similar to isDerivedFrom()
, but also matches classes that directly match Base
.
Definition at line 3353 of file ASTMatchers.h.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | isSameOrDerivedFrom | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(CXXRecordDecl, ObjCInterfaceDecl) | , | ||
std::string | , | ||
BaseName | , | ||
1 | |||
) |
Overloaded method as shortcut for isSameOrDerivedFrom(hasName(...))
.
Definition at line 3368 of file ASTMatchers.h.
clang::ast_matchers::AST_POLYMORPHIC_MATCHER_REGEX | ( | isExpansionInFileMatching | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc) | , | ||
RegExp | |||
) |
Matches AST nodes that were expanded within files whose name is partially matching a given regex.
Example matches Y but not X (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
ASTMatcher.h:
Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
Definition at line 293 of file ASTMatchers.h.
References Filename, clang::SourceManager::getExpansionLoc(), clang::SourceManager::getFileEntryRefForID(), clang::SourceManager::getFileID(), and Node.
clang::ast_matchers::AST_TYPE_TRAVERSE_MATCHER | ( | hasDeducedType | , |
getDeducedType | , | ||
AST_POLYMORPHIC_SUPPORTED_TYPES(AutoType) | |||
) |
clang::ast_matchers::AST_TYPE_TRAVERSE_MATCHER | ( | hasReplacementType | , |
getReplacementType | , | ||
AST_POLYMORPHIC_SUPPORTED_TYPES(SubstTemplateTypeParmType) | |||
) |
Matches template type parameter substitutions that have a replacement type that matches the provided matcher.
Given
substTemplateTypeParmType
(hasReplacementType(type())) matches int
clang::ast_matchers::AST_TYPE_TRAVERSE_MATCHER | ( | hasUnderlyingType | , |
getUnderlyingType | , | ||
AST_POLYMORPHIC_SUPPORTED_TYPES(DecltypeType, UsingType) | |||
) |
Matches DecltypeType
or UsingType
nodes to find the underlying type.
Given
decltypeType(hasUnderlyingType(isInteger())) matches the type of "a"
Usable as: Matcher<DecltypeType>, Matcher<UsingType>
clang::ast_matchers::AST_TYPE_TRAVERSE_MATCHER | ( | innerType | , |
getInnerType | , | ||
AST_POLYMORPHIC_SUPPORTED_TYPES(ParenType) | |||
) |
clang::ast_matchers::AST_TYPELOC_TRAVERSE_MATCHER_DECL | ( | hasElementType | , |
getElement | , | ||
AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType, ComplexType) | |||
) |
Matches arrays and C99 complex types that have a specific element type.
Given
arrayType(hasElementType(builtinType())) matches "int b[7]"
Usable as: Matcher<ArrayType>, Matcher<ComplexType>
clang::ast_matchers::AST_TYPELOC_TRAVERSE_MATCHER_DECL | ( | hasValueType | , |
getValue | , | ||
AST_POLYMORPHIC_SUPPORTED_TYPES(AtomicType) | |||
) |
clang::ast_matchers::AST_TYPELOC_TRAVERSE_MATCHER_DECL | ( | pointee | , |
getPointee | , | ||
AST_POLYMORPHIC_SUPPORTED_TYPES(BlockPointerType, MemberPointerType, PointerType, ReferenceType, ObjCObjectPointerType) | |||
) |
Narrows PointerType (and similar) matchers to those where the pointee
matches a given matcher.
Given
pointerType(pointee(isConstQualified(), isInteger())) matches "int const *b"
Usable as: Matcher<BlockPointerType>, Matcher<MemberPointerType>, Matcher<PointerType>, Matcher<ReferenceType>
clang::ast_matchers::AST_TYPELOC_TRAVERSE_MATCHER_DEF | ( | hasElementType | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(ArrayType, ComplexType) | |||
) |
clang::ast_matchers::AST_TYPELOC_TRAVERSE_MATCHER_DEF | ( | hasValueType | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(AtomicType) | |||
) |
clang::ast_matchers::AST_TYPELOC_TRAVERSE_MATCHER_DEF | ( | pointee | , |
AST_POLYMORPHIC_SUPPORTED_TYPES(BlockPointerType, MemberPointerType, PointerType, ReferenceType, ObjCObjectPointerType) | |||
) |
internal::PolymorphicMatcher< internal::ValueEqualsMatcher, void(internal::AllNodeBaseTypes), ValueT > clang::ast_matchers::equals | ( | const ValueT & | Value | ) |
Matches literals that are equal to the given value of type ValueT.
Given
characterLiteral(equals(0)) matches '\0' cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0)) match false floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2)) match 3.14 integerLiteral(equals(42)) matches 42
Note that you cannot directly match a negative numeric literal because the minus sign is not part of the literal: It is a unary operator whose operand is the positive numeric literal. Instead, you must use a unaryOperator() matcher to match the minus sign:
unaryOperator(hasOperatorName("-"), hasUnaryOperand(integerLiteral(equals(13))))
Usable as: Matcher<CharacterLiteral>, Matcher<CXXBoolLiteralExpr>, Matcher<FloatingLiteral>, Matcher<IntegerLiteral>
Definition at line 5859 of file ASTMatchers.h.
Referenced by AST_MATCHER_FUNCTION().
internal::Matcher< T > clang::ast_matchers::findAll | ( | const internal::Matcher< T > & | Matcher | ) |
Matches if the node or any descendant matches.
Generates results for each match.
For example, in:
The matcher:
will generate results for A
, B
and C
.
Usable as: Any Matcher
Definition at line 3579 of file ASTMatchers.h.
References eachOf, and forEachDescendant.
Referenced by clang::ento::getWidenedLoopState().
|
static |
Definition at line 38 of file GtestMatchers.cpp.
References cxxMethodDecl, cxxRecordDecl, Eq, functionDecl, Ge, Gt, hasName(), Le, Lt, and Ne.
Referenced by gtestComparisonInternal().
|
static |
Definition at line 70 of file GtestMatchers.cpp.
References Eq, Ge, Gt, Le, Lt, and Ne.
Referenced by getMacroName().
|
static |
Definition at line 88 of file GtestMatchers.cpp.
References getComparisonTypeName(), and getMacroTypeName().
Referenced by gtestCallInternal(), gtestComparisonInternal(), gtestThatInternal(), and clang::ento::SuppressInlineDefensiveChecksVisitor::VisitNode().
|
static |
Definition at line 92 of file GtestMatchers.cpp.
References getMacroTypeName().
|
static |
Definition at line 58 of file GtestMatchers.cpp.
Referenced by getMacroName().
|
static |
Definition at line 100 of file GtestMatchers.cpp.
Referenced by gtestCallInternal().
internal::BindableMatcher< Stmt > clang::ast_matchers::gtestAssert | ( | GtestCmp | Cmp, |
StatementMatcher | Left, | ||
StatementMatcher | Right | ||
) |
Matcher for gtest's ASSERT comparison macros including ASSERT_EQ, ASSERT_NE, ASSERT_GE, ASSERT_GT, ASSERT_LE and ASSERT_LT.
Definition at line 190 of file GtestMatchers.cpp.
References gtestComparisonInternal().
internal::BindableMatcher< Stmt > clang::ast_matchers::gtestAssertThat | ( | StatementMatcher | Actual, |
StatementMatcher | Matcher | ||
) |
Matcher for gtest's ASSERT_THAT macro.
Definition at line 200 of file GtestMatchers.cpp.
References gtestThatInternal().
|
static |
Definition at line 146 of file GtestMatchers.cpp.
References cxxMemberCallExpr, cxxOperatorCallExpr, functionDecl, getMacroName(), getSpecSetterName(), hasName(), hasOverloadedOperatorName(), None, and Some.
Referenced by gtestCallInternal(), gtestExpectCall(), and gtestOnCall().
|
static |
Definition at line 180 of file GtestMatchers.cpp.
References cxxMemberCallExpr, functionDecl, gtestCallInternal(), and hasName().
|
static |
Definition at line 122 of file GtestMatchers.cpp.
References callExpr, getComparisonDecl(), and getMacroName().
Referenced by gtestAssert(), and gtestExpect().
internal::BindableMatcher< Stmt > clang::ast_matchers::gtestExpect | ( | GtestCmp | Cmp, |
StatementMatcher | Left, | ||
StatementMatcher | Right | ||
) |
Matcher for gtest's EXPECT comparison macros including EXPECT_EQ, EXPECT_NE, EXPECT_GE, EXPECT_GT, EXPECT_LE and EXPECT_LT.
Definition at line 195 of file GtestMatchers.cpp.
References gtestComparisonInternal().
internal::BindableMatcher< Stmt > clang::ast_matchers::gtestExpectCall | ( | StatementMatcher | MockCall, |
MockArgs | Args | ||
) |
Matcher for gtest's EXPECT_CALL macro.
MockCall
matches the whole mock member method call. This API is more flexible but requires more knowledge of the AST structure of EXPECT_CALL macros.
Definition at line 227 of file GtestMatchers.cpp.
References gtestCallInternal().
internal::BindableMatcher< Stmt > clang::ast_matchers::gtestExpectCall | ( | StatementMatcher | MockObject, |
llvm::StringRef | MockMethodName, | ||
MockArgs | Args | ||
) |
Matcher for gtest's EXPECT_CALL macro.
MockObject
matches the mock object and MockMethodName
is the name of the method invoked on the mock object.
Definition at line 221 of file GtestMatchers.cpp.
References gtestCallInternal().
internal::BindableMatcher< Stmt > clang::ast_matchers::gtestExpectThat | ( | StatementMatcher | Actual, |
StatementMatcher | Matcher | ||
) |
Matcher for gtest's EXPECT_THAT macro.
Definition at line 205 of file GtestMatchers.cpp.
References gtestThatInternal().
internal::BindableMatcher< Stmt > clang::ast_matchers::gtestOnCall | ( | StatementMatcher | MockCall, |
MockArgs | Args | ||
) |
Like the second gtestExpectCall
overload but for ON_CALL
.
Definition at line 216 of file GtestMatchers.cpp.
References gtestCallInternal().
internal::BindableMatcher< Stmt > clang::ast_matchers::gtestOnCall | ( | StatementMatcher | MockObject, |
llvm::StringRef | MockMethodName, | ||
MockArgs | Args | ||
) |
Like the first gtestExpectCall
overload but for ON_CALL
.
Definition at line 210 of file GtestMatchers.cpp.
References gtestCallInternal().
|
static |
Definition at line 130 of file GtestMatchers.cpp.
References callExpr, classTemplateSpecializationDecl, cxxOperatorCallExpr, expr, functionDecl, getMacroName(), hasName(), and hasOverloadedOperatorName().
Referenced by gtestAssertThat(), and gtestExpectThat().
|
static |
Definition at line 221 of file UnsafeBufferUsage.cpp.
References arrayType.
Referenced by findGadgets().
|
inline |
Matches a node if the declaration associated with that node matches the given matcher.
The associated declaration is:
For type nodes, hasDeclaration will generally match the declaration of the sugared type. Given
in varDecl(hasType(hasDeclaration(decl()))) the decl will match the typedefDecl. A common use case is to match the underlying, desugared type. This can be achieved by using the hasUnqualifiedDesugaredType matcher:
In this matcher, the decl will match the CXXRecordDecl of class X.
Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, Matcher<TagType>, Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>, Matcher<TypedefType>, Matcher<UnresolvedUsingType>
Definition at line 3664 of file ASTMatchers.h.
Referenced by AST_MATCHER_P_OVERLOAD(), AST_POLYMORPHIC_MATCHER_P2(), AST_POLYMORPHIC_MATCHER_P_OVERLOAD(), clang::ento::getAddrTo(), hasTypePointingTo(), hasUnguardedAccess(), clang::tooling::isKnownPointerLikeType(), and potentiallyWritesIntoIvar().
|
inline |
Matches NamedDecl nodes that have the specified name.
Supports specifying enclosing namespaces or classes by prefixing the name with '<enclosing>::'. Does not match typedefs of an underlying type with the given name.
Example matches X (Name == "X")
Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
Definition at line 3090 of file ASTMatchers.h.
Referenced by AST_POLYMORPHIC_MATCHER_P_OVERLOAD(), getComparisonDecl(), getRunLoopRunM(), gtestCallInternal(), gtestThatInternal(), and isExactClass().
|
inline |
Matches overloaded operator names.
Matches overloaded operator names specified in strings without the "operator" prefix: e.g. "<<".
Given:
cxxOperatorCallExpr
(hasOverloadedOperatorName("<<"))) matches the specified line and cxxRecordDecl
(hasMethod(hasOverloadedOperatorName("*"))) matches the declaration of A
.
Usable as: Matcher<CXXOperatorCallExpr>, Matcher<FunctionDecl>
Definition at line 3153 of file ASTMatchers.h.
References AST_POLYMORPHIC_SUPPORTED_TYPES.
Referenced by gtestCallInternal(), and gtestThatInternal().
|
static |
Definition at line 217 of file UnsafeBufferUsage.cpp.
References pointerType.
Referenced by findGadgets(), isInUnspecifiedPointerContext(), UUCAddAssignGadget::matcher(), and DerefSimplePtrArithFixableGadget::matcher().
|
static |
Definition at line 270 of file UnsafeBufferUsage.cpp.
References anyOf, binaryOperator, expr, hasAnyOperatorName, and implicitCastExpr.
Referenced by DerefSimplePtrArithFixableGadget::matcher().
|
static |
Definition at line 288 of file UnsafeBufferUsage.cpp.
References allOf, anyOf, binaryOperator, callExpr, castExpr, eachOf, functionDecl, hasAnyOperatorName, hasAttr(), hasPointerType(), stmt, and unless.
Referenced by UPCPreIncrementGadget::matcher().
|
static |
Definition at line 344 of file UnsafeBufferUsage.cpp.
References anyOf, compoundStmt, forEach, ifStmt, and stmt.
Referenced by UUCAddAssignGadget::matcher().
auto clang::ast_matchers::mapAnyOf | ( | internal::VariadicDynCastAllOfMatcher< T, U > const & | ... | ) |
Matches any of the NodeMatchers
with InnerMatchers nested within.
Given
with the matcher
matches the if
and the for
. It is equivalent to:
The with() chain-call accepts zero or more matchers which are combined as-if with allOf() in each of the node matchers. Usable as: Any Matcher
Definition at line 2912 of file ASTMatchers.h.
SmallVector< BoundNodes, 1 > clang::ast_matchers::match | ( | MatcherT | Matcher, |
ASTContext & | Context | ||
) |
Returns the results of matching Matcher
on the translation unit of Context
and collects the BoundNodes
of all callback invocations.
Definition at line 319 of file ASTMatchFinder.h.
SmallVector< BoundNodes, 1 > clang::ast_matchers::match | ( | MatcherT | Matcher, |
const DynTypedNode & | Node, | ||
ASTContext & | Context | ||
) |
Definition at line 302 of file ASTMatchFinder.h.
References Node.
SmallVector< BoundNodes, 1 > clang::ast_matchers::match | ( | MatcherT | Matcher, |
const NodeT & | Node, | ||
ASTContext & | Context | ||
) |
Returns the results of matching Matcher
on Node
.
Collects the BoundNodes
of all callback invocations when matching Matcher
on Node
and returns the collected results.
Multiple results occur when using matchers like forEachDescendant
, which generate a result for each sub-match.
If you want to find all matches on the sub-tree rooted at Node
(rather than only the matches on Node
itself), surround the Matcher
with a findAll()
.
Definition at line 313 of file ASTMatchFinder.h.
References clang::DynTypedNode::create(), match(), and Node.
Referenced by clang::SemaObjC::ActOnAtEnd(), clang::Sema::ActOnCXXDelete(), clang::SemaOpenACC::ActOnIntExpr(), AttributesMatch(), checkTempObjectsInNoPool(), checkTempObjectsInSamePool(), ClassImplementsAllMethodsAndProperties(), clang::tooling::IncludeCategoryManager::getIncludePriority(), clang::tooling::IncludeCategoryManager::getSortIncludePriority(), clang::ento::getWidenedLoopState(), hasUnguardedAccess(), isExactClass(), clang::tooling::isKnownPointerLikeType(), clang::ento::isPossiblyEscaped(), isSubclass(), clang::ExprMutationAnalyzer::isUnevaluated(), match(), MatchTwoAttributeLists(), clang::ASTContext::ObjCQualifiedClassTypesAreCompatible(), clang::ASTContext::ObjCQualifiedIdTypesAreCompatible(), potentiallyWritesIntoIvar(), clang::ento::shouldCompletelyUnroll(), clang::format::sortCppIncludes(), and clang::SemaObjC::WarnExactTypedMethods().
|
inline |
Definition at line 345 of file ASTMatchFinder.h.
|
inline |
Definition at line 328 of file ASTMatchFinder.h.
References Node.
Referenced by clang::dataflow::ASTMatchSwitchBuilder< BaseT, State, Result >::Build(), and matchDynamic().
SmallVector< BoundNodes, 1 > clang::ast_matchers::matchDynamic | ( | internal::DynTypedMatcher | Matcher, |
const NodeT & | Node, | ||
ASTContext & | Context | ||
) |
Definition at line 338 of file ASTMatchFinder.h.
References clang::DynTypedNode::create(), matchDynamic(), and Node.
const NodeT * clang::ast_matchers::selectFirst | ( | StringRef | BoundTo, |
const SmallVectorImpl< BoundNodes > & | Results | ||
) |
Returns the first result of type NodeT
bound to BoundTo
.
Returns NULL
if there is no match, or if the matching node cannot be casted to NodeT
.
This is useful in combanation with match()
:
Definition at line 278 of file ASTMatchFinder.h.
References Node.
|
inline |
Same as unaryExprOrTypeTraitExpr, but only matching sizeof.
Definition at line 3069 of file ASTMatchers.h.
References allOf, stmt, and unaryExprOrTypeTraitExpr.
Referenced by clang::ExprMutationAnalyzer::isUnevaluated().
internal::TraversalWrapper< internal::ArgumentAdaptingMatcherFuncAdaptor< ArgumentAdapterT, T, ToTypes > > clang::ast_matchers::traverse | ( | TraversalKind | TK, |
const internal::ArgumentAdaptingMatcherFuncAdaptor< ArgumentAdapterT, T, ToTypes > & | InnerMatcher | ||
) |
Definition at line 847 of file ASTMatchers.h.
References clang::T.
internal::BindableMatcher< T > clang::ast_matchers::traverse | ( | TraversalKind | TK, |
const internal::BindableMatcher< T > & | InnerMatcher | ||
) |
Definition at line 827 of file ASTMatchers.h.
internal::Matcher< typename internal::GetClade< T... >::Type > clang::ast_matchers::traverse | ( | TraversalKind | TK, |
const internal::MapAnyOfHelper< T... > & | InnerMatcher | ||
) |
Definition at line 868 of file ASTMatchers.h.
References traverse().
internal::Matcher< T > clang::ast_matchers::traverse | ( | TraversalKind | TK, |
const internal::Matcher< T > & | InnerMatcher | ||
) |
Causes all nested matchers to be matched with the specified traversal kind.
Given
The matcher
matches the variable declaration with "init" bound to the "3.0".
Definition at line 817 of file ASTMatchers.h.
Referenced by clang::ast_matchers::MatchFinder::addMatcher(), clang::syntax::Node::assertInvariantsRecursive(), clang::threadSafety::BeforeSet::checkBeforeAfter(), clang::syntax::Node::dumpTokens(), and traverse().
internal::TraversalWrapper< internal::PolymorphicMatcher< MatcherT, ReturnTypesF, P... > > clang::ast_matchers::traverse | ( | TraversalKind | TK, |
const internal::PolymorphicMatcher< MatcherT, ReturnTypesF, P... > & | InnerMatcher | ||
) |
Definition at line 858 of file ASTMatchers.h.
References P.
internal::TraversalWrapper< internal::VariadicOperatorMatcher< T... > > clang::ast_matchers::traverse | ( | TraversalKind | TK, |
const internal::VariadicOperatorMatcher< T... > & | InnerMatcher | ||
) |
Definition at line 837 of file ASTMatchers.h.
References clang::T.
const internal::VariadicDynCastAllOfMatcher< Decl, AccessSpecDecl > clang::ast_matchers::accessSpecDecl |
Matches C++ access specifier declarations.
Given
accessSpecDecl() matches 'public:'
Definition at line 786 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, AddrLabelExpr > clang::ast_matchers::addrLabelExpr |
Matches address of label statements (GNU extension).
Given
addrLabelExpr() matches '&&FOO'
Definition at line 941 of file ASTMatchersInternal.cpp.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> clang::ast_matchers::allOf = {internal::DynTypedMatcher::VO_AllOf} |
Matches if all given matchers match.
Usable as: Any Matcher
Definition at line 1032 of file ASTMatchersInternal.cpp.
Referenced by alignOfExpr(), clang::ento::assignedToRef(), AST_POLYMORPHIC_MATCHER_P2(), findGadgets(), clang::ento::forLoopMatcher(), isInUnspecifiedPointerContext(), and sizeOfExpr().
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> clang::ast_matchers::anyOf = {internal::DynTypedMatcher::VO_AnyOf} |
Matches if any of the given matchers matches.
Usable as: Any Matcher
Definition at line 1029 of file ASTMatchersInternal.cpp.
Referenced by alignOfExpr(), clang::ento::assignedToRef(), AST_MATCHER_FUNCTION(), AST_MATCHER_P_OVERLOAD(), AST_POLYMORPHIC_MATCHER_P(), AST_POLYMORPHIC_MATCHER_P2(), AST_POLYMORPHIC_MATCHER_P_OVERLOAD(), clang::ento::changeIntBoundNode(), findGadgets(), clang::ento::forLoopMatcher(), getOtherMessageSentM(), getRunLoopRunM(), clang::ento::hasSuspiciousStmt(), hasUnguardedAccess(), isInUnspecifiedLvalueContext(), isInUnspecifiedPointerContext(), isInUnspecifiedUntypedContext(), clang::ento::isPossiblyEscaped(), clang::ExprMutationAnalyzer::isUnevaluated(), DerefSimplePtrArithFixableGadget::matcher(), and clang::ento::simpleCondition().
const internal::VariadicDynCastAllOfMatcher< Stmt, ArrayInitIndexExpr > clang::ast_matchers::arrayInitIndexExpr |
The arrayInitIndexExpr consists of two subexpressions: a common expression (the source array) that is evaluated once up-front, and a per-element initializer that runs once for each array element.
Within the per-element initializer, the current index may be obtained via an ArrayInitIndexExpr.
Given
arrayInitIndexExpr() matches the array index that implicitly iterates over the array a
to copy each element to the anonymous array that backs the structured binding [x, y]
elements of which are referred to by their aliases x
and y
.
Definition at line 915 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArrayInitLoopExpr > clang::ast_matchers::arrayInitLoopExpr |
Matches a loop initializing the elements of an array in a number of contexts:
Given
arrayInitLoopExpr() matches the implicit loop that initializes each element of the implicit array field inside the lambda object, that represents the array a
captured by value.
Definition at line 917 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ArraySubscriptExpr > clang::ast_matchers::arraySubscriptExpr |
Matches array subscript expressions.
Given
arraySubscriptExpr() matches "a[1]"
Definition at line 913 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< ArrayType > clang::ast_matchers::arrayType |
Matches all kinds of arrays.
Given
arrayType() matches "int a[]", "int b[4]" and "int c[a[0]]";
Definition at line 1074 of file ASTMatchersInternal.cpp.
Referenced by clang::CodeGen::swiftcall::SwiftAggLowering::addTypedData(), emitArraySubscriptGEP(), emitPartialArrayDestroy(), getArrayDepth(), clang::Type::getBaseElementTypeUnsafe(), clang::ASTContext::getDeclAlign(), clang::CFGImplicitDtor::getDestructorDecl(), hasArrayType(), and IsStringInit().
Matches asm statements.
asmStmt() matches '__asm("mov al, 2")'
Definition at line 953 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, AtomicExpr > clang::ast_matchers::atomicExpr |
Matches atomic builtins.
Example matches __atomic_load_n(ptr, 1)
Definition at line 984 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< AtomicType > clang::ast_matchers::atomicType |
Matches atomic types.
Given
atomicType() matches "_Atomic(int) i"
Definition at line 1083 of file ASTMatchersInternal.cpp.
Referenced by clang::CodeGen::swiftcall::SwiftAggLowering::addTypedData().
const internal::VariadicAllOfMatcher< Attr > clang::ast_matchers::attr |
Matches attributes.
Attributes may be attached with a variety of different syntaxes (including keywords, C++11 attributes, GNU __attribute
and MSVC
__declspec, and
#pragma``s). They may also be implicit.
Given
attr() matches "nodiscard", "nonnull", "noinline", and the whole "#pragma" line.
Definition at line 1070 of file ASTMatchersInternal.cpp.
Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::SemaObjC::ActOnMethodDeclaration(), clang::SemaObjC::actOnObjCTypeParam(), clang::ParsedAttributes::addNew(), clang::ParsedAttributes::addNewPropertyAttr(), clang::ParsedAttributes::addNewTypeAttr(), clang::ParsedAttributes::addNewTypeTagForDatatype(), clang::arcmt::trans::MigrationContext::addPropertyAttribute(), append_attr(), clang::applyObjCTypeArgs(), checkObjCKindOfType(), clang::SemaObjC::CheckObjCMethodDirectOverrides(), checkPropertyDeclWithOwnership(), diagnoseBadTypeAttribute(), distributeFunctionTypeAttr(), distributeFunctionTypeAttrFromDeclarator(), distributeFunctionTypeAttrFromDeclSpec(), distributeFunctionTypeAttrToInnermost(), distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), distributeObjCPointerTypeAttrFromDeclarator(), distributeTypeAttrsFromDeclarator(), clang::TypeLoc::findExplicitQualifierLoc(), clang::ASTContext::getAttributedType(), GetExternalSourceContainer(), clang::Decl::getExternalSourceSymbolAttr(), GetFullTypeForDeclarator(), clang::ObjCMethodDecl::getMethodFamily(), getObjCBridgeAttr(), getOwnershipRule(), getVisibilityFromAttr(), handleFunctionTypeAttr(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), handleObjCPointerTypeAttr(), isAbstractAttrMatcherRule(), isGeneratedDecl(), moveAttrFromListToList(), ProcessAPINotes(), processTypeAttrs(), clang::AttributedType::Profile(), transferARCOwnershipToDeclaratorChunk(), clang::arcmt::trans::BlockObjCVariableTraverser::traverseBody(), and ValidateMultipleRegisterAnnotations().
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAutoreleasePoolStmt > clang::ast_matchers::autoreleasePoolStmt |
Matches an Objective-C autorelease pool statement.
Given
autoreleasePoolStmt(stmt()) matches the declaration of "x" inside the autorelease pool.
Definition at line 753 of file ASTMatchersInternal.cpp.
Referenced by checkTempObjectsInNoPool(), and checkTempObjectsInSamePool().
const AstTypeMatcher< AutoType > clang::ast_matchers::autoType |
Matches types nodes representing C++11 auto types.
Given:
autoType() matches "auto n" and "auto i"
Definition at line 1084 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryConditionalOperator > clang::ast_matchers::binaryConditionalOperator |
Matches binary conditional operator expressions (GNU extension).
Example matches a ?: b
Definition at line 996 of file ASTMatchersInternal.cpp.
const internal::MapAnyOfMatcher< BinaryOperator, CXXOperatorCallExpr, CXXRewrittenBinaryOperator > clang::ast_matchers::binaryOperation |
Matches nodes which can be used with binary operators.
The code
might be represented in the clang AST as a binaryOperator, a cxxOperatorCallExpr or a cxxRewrittenBinaryOperator, depending on
This matcher elides details in places where the matchers for the nodes are compatible.
Given
matches each use of "!=" in:
Definition at line 990 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, BinaryOperator > clang::ast_matchers::binaryOperator |
Matches binary operator expressions.
Example matches a || b
See also the binaryOperation() matcher for more-general matching.
Definition at line 987 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::changeIntBoundNode(), clang::ento::forLoopMatcher(), isInUnspecifiedLvalueContext(), isInUnspecifiedPointerContext(), UUCAddAssignGadget::matcher(), DerefSimplePtrArithFixableGadget::matcher(), potentiallyWritesIntoIvar(), and clang::ento::simpleCondition().
const internal::VariadicDynCastAllOfMatcher< Decl, BindingDecl > clang::ast_matchers::bindingDecl |
Matches binding declarations Example matches foo
and bar
(matcher = bindingDecl()
Definition at line 764 of file ASTMatchersInternal.cpp.
Referenced by findGadgets().
Matches block declarations.
Example matches the declaration of the nameless block printing an input integer.
Definition at line 866 of file ASTMatchersInternal.cpp.
Referenced by clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable().
Matches a reference to a block.
Example: matches "^{}":
Definition at line 928 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< BlockPointerType > clang::ast_matchers::blockPointerType |
Matches block pointer types, i.e.
types syntactically represented as "void (^)(int)".
The pointee
is always required to be a FunctionType
.
Definition at line 1089 of file ASTMatchersInternal.cpp.
Matches break statements.
Given
breakStmt() matches 'break'
Definition at line 935 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< BuiltinType > clang::ast_matchers::builtinType |
Matches builtin Types.
Given
builtinType() matches "int b", "float c" and "bool d"
Definition at line 1073 of file ASTMatchersInternal.cpp.
Matches call expressions.
Example matches x.y() and y()
Definition at line 847 of file ASTMatchersInternal.cpp.
Referenced by clang::SemaObjC::ActOnPropertyImplDecl(), AST_POLYMORPHIC_MATCHER_P2(), AST_POLYMORPHIC_MATCHER_P_OVERLOAD(), clang::ento::callByRef(), getRunLoopRunM(), gtestComparisonInternal(), gtestThatInternal(), hasUnguardedAccess(), and isInUnspecifiedPointerContext().
Matches case statements inside switch statements.
Given
caseStmt() matches 'case 42:'.
Definition at line 944 of file ASTMatchersInternal.cpp.
Matches any cast nodes of Clang's AST.
Example: castExpr() matches each of the following:
but does not match
Definition at line 1015 of file ASTMatchersInternal.cpp.
Referenced by addFixitForObjCARCConversion(), CheckObjCBridgeCFCast(), CheckObjCBridgeNSCast(), clang::SemaObjC::CheckObjCBridgeRelatedCast(), clang::SemaObjC::CheckObjCConversion(), clang::SemaObjC::CheckTollFreeBridgeCast(), clang::SemaObjC::CheckTollFreeBridgeStaticCast(), clang::SemaObjC::diagnoseARCUnbridgedCast(), diagnoseObjCARCConversion(), isInUnspecifiedPointerContext(), and tryEmitARCCopyWeakInit().
const internal::VariadicDynCastAllOfMatcher< Stmt, CharacterLiteral > clang::ast_matchers::characterLiteral |
Matches character literals (also matches wchar_t).
Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral), though.
Example matches 'a', L'a'
Definition at line 959 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ChooseExpr > clang::ast_matchers::chooseExpr |
Matches GNU __builtin_choose_expr.
Definition at line 972 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateDecl > clang::ast_matchers::classTemplateDecl |
Matches C++ class template declarations.
Example matches Z
Definition at line 775 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplatePartialSpecializationDecl > clang::ast_matchers::classTemplatePartialSpecializationDecl |
Matches C++ class template partial specializations.
Given
classTemplatePartialSpecializationDecl() matches the specialization A<T,T*,I>
but not A<int,int,1>
Definition at line 781 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ClassTemplateSpecializationDecl > clang::ast_matchers::classTemplateSpecializationDecl |
Matches C++ class template specializations.
Given
classTemplateSpecializationDecl() matches the specializations A<int>
and A<double>
Definition at line 778 of file ASTMatchersInternal.cpp.
Referenced by gtestThatInternal().
const internal::VariadicDynCastAllOfMatcher< Stmt, CoawaitExpr > clang::ast_matchers::coawaitExpr |
Matches co_await expressions.
Given
coawaitExpr() matches 'co_await 1'
Definition at line 976 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< ComplexType > clang::ast_matchers::complexType |
Matches C99 complex types.
Given
complexType() matches "_Complex float f"
Definition at line 1075 of file ASTMatchersInternal.cpp.
Referenced by clang::CodeGen::swiftcall::SwiftAggLowering::addTypedData().
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundLiteralExpr > clang::ast_matchers::compoundLiteralExpr |
Matches compound (i.e.
non-scalar) literals
Example match: {1}, (1, 2)
Definition at line 969 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CompoundStmt > clang::ast_matchers::compoundStmt |
Matches compound statements.
Example matches '{}' and '{{}}' in 'for (;;) {{}}'
Definition at line 946 of file ASTMatchersInternal.cpp.
Referenced by isInUnspecifiedUntypedContext().
const internal::VariadicDynCastAllOfMatcher< Decl, ConceptDecl > clang::ast_matchers::conceptDecl |
Matches concept declarations.
Example matches integral
Definition at line 831 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConditionalOperator > clang::ast_matchers::conditionalOperator |
Matches conditional operator expressions.
Example matches a ? b : c
Definition at line 994 of file ASTMatchersInternal.cpp.
Referenced by hasUnguardedAccess().
const AstTypeMatcher< ConstantArrayType > clang::ast_matchers::constantArrayType |
Matches C arrays with a specified constant size.
Given
constantArrayType() matches "int a[2]"
Definition at line 1076 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConstantExpr > clang::ast_matchers::constantExpr |
Matches a constant expression wrapper.
Example matches the constant in the case statement: (matcher = constantExpr())
Definition at line 897 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ContinueStmt > clang::ast_matchers::continueStmt |
Matches continue statements.
Given
continueStmt() matches 'continue'
Definition at line 936 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ConvertVectorExpr > clang::ast_matchers::convertVectorExpr |
Matches builtin function __builtin_convertvector.
Definition at line 974 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CoreturnStmt > clang::ast_matchers::coreturnStmt |
Matches co_return statements.
Given
coreturnStmt() matches 'co_return'
Definition at line 937 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CoroutineBodyStmt > clang::ast_matchers::coroutineBodyStmt |
Matches coroutine body statements.
coroutineBodyStmt() matches the coroutine below
Definition at line 948 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CoyieldExpr > clang::ast_matchers::coyieldExpr |
Matches co_yield expressions.
Given
coyieldExpr() matches 'co_yield 1'
Definition at line 980 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CStyleCastExpr > clang::ast_matchers::cStyleCastExpr |
Matches a C-style cast expression.
Example: Matches (int) 2.2f in
Definition at line 1010 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > clang::ast_matchers::cudaKernelCallExpr |
Matches CUDA kernel call expression.
Example matches,
Definition at line 1072 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< CXXBaseSpecifier > clang::ast_matchers::cxxBaseSpecifier |
Matches class bases.
Examples matches public
virtual B.
Definition at line 787 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBindTemporaryExpr > clang::ast_matchers::cxxBindTemporaryExpr |
Matches nodes where temporaries are created.
Example matches FunctionTakesString(GetStringByValue()) (matcher = cxxBindTemporaryExpr())
Definition at line 905 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXBoolLiteralExpr > clang::ast_matchers::cxxBoolLiteral |
Matches bool literals.
Example matches true
Definition at line 955 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXCatchStmt > clang::ast_matchers::cxxCatchStmt |
Matches catch statements.
cxxCatchStmt() matches 'catch(int i)'
Definition at line 949 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstCastExpr > clang::ast_matchers::cxxConstCastExpr |
Matches a const_cast expression.
Example: Matches const_cast<int*>(&r) in
Definition at line 1008 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXConstructExpr > clang::ast_matchers::cxxConstructExpr |
Matches constructor call expressions (including implicit ones).
Example matches string(ptr, n) and ptr within arguments of f (matcher = cxxConstructExpr())
Definition at line 900 of file ASTMatchersInternal.cpp.
Referenced by AST_POLYMORPHIC_MATCHER_P2().
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConstructorDecl > clang::ast_matchers::cxxConstructorDecl |
Matches C++ constructor declarations.
Example matches Foo::Foo() and Foo::Foo(int)
Definition at line 821 of file ASTMatchersInternal.cpp.
Referenced by AST_POLYMORPHIC_MATCHER_P2().
const internal::VariadicDynCastAllOfMatcher< Decl, CXXConversionDecl > clang::ast_matchers::cxxConversionDecl |
Matches conversion operator declarations.
Example matches the operator.
Definition at line 830 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< CXXCtorInitializer > clang::ast_matchers::cxxCtorInitializer |
Matches constructor initializers.
Examples matches i(42)
.
Definition at line 788 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDeductionGuideDecl > clang::ast_matchers::cxxDeductionGuideDecl |
Matches user-defined and implicitly generated deduction guide.
Example matches the deduction guide.
Definition at line 1125 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDefaultArgExpr > clang::ast_matchers::cxxDefaultArgExpr |
Matches the value of a default argument at the call site.
Example matches the CXXDefaultArgExpr placeholder inserted for the default value of the second parameter in the call expression f(42) (matcher = cxxDefaultArgExpr())
Definition at line 919 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDeleteExpr > clang::ast_matchers::cxxDeleteExpr |
Matches delete expressions.
Given
cxxDeleteExpr() matches 'delete X'.
Definition at line 909 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDependentScopeMemberExpr > clang::ast_matchers::cxxDependentScopeMemberExpr |
Matches member expressions where the actual member referenced could not be resolved because the base expression or the member name was dependent.
Given
cxxDependentScopeMemberExpr() matches t.g
Definition at line 846 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, CXXDestructorDecl > clang::ast_matchers::cxxDestructorDecl |
Matches explicit C++ destructor declarations.
Example matches Foo::~Foo()
Definition at line 823 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXDynamicCastExpr > clang::ast_matchers::cxxDynamicCastExpr |
Matches a dynamic_cast expression.
Example: cxxDynamicCastExpr() matches dynamic_cast<D*>(&b); in
Definition at line 1006 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFoldExpr > clang::ast_matchers::cxxFoldExpr |
Matches C++17 fold expressions.
Example matches (0 + ... + args)
:
Definition at line 924 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXForRangeStmt > clang::ast_matchers::cxxForRangeStmt |
Matches range-based for statements.
cxxForRangeStmt() matches 'for (auto a : i)'
Definition at line 932 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXFunctionalCastExpr > clang::ast_matchers::cxxFunctionalCastExpr |
Matches functional cast expressions.
Example: Matches Foo(bar);
Definition at line 1017 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > clang::ast_matchers::cxxMemberCallExpr |
Matches member call expressions.
Example matches x.y()
Definition at line 850 of file ASTMatchersInternal.cpp.
Referenced by gtestCallInternal().
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > clang::ast_matchers::cxxMethodDecl |
Matches method declarations.
Example matches y
Definition at line 828 of file ASTMatchersInternal.cpp.
Referenced by AST_POLYMORPHIC_MATCHER_P2(), and getComparisonDecl().
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNewExpr > clang::ast_matchers::cxxNewExpr |
Matches new expressions.
Given
cxxNewExpr() matches 'new X'.
Definition at line 908 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNoexceptExpr > clang::ast_matchers::cxxNoexceptExpr |
Matches noexcept expressions.
Given
cxxNoexceptExpr() matches noexcept(a())
, noexcept(b())
and noexcept(c())
. doesn't match the noexcept specifier in the declarations a, b, c or d.
Definition at line 911 of file ASTMatchersInternal.cpp.
Referenced by clang::ExprMutationAnalyzer::isUnevaluated().
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXNullPtrLiteralExpr > clang::ast_matchers::cxxNullPtrLiteralExpr |
Matches nullptr literal.
Definition at line 971 of file ASTMatchersInternal.cpp.
Referenced by AST_MATCHER_FUNCTION().
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > clang::ast_matchers::cxxOperatorCallExpr |
Matches overloaded operator calls.
Note that if an operator isn't overloaded, it won't match. Instead, use binaryOperator matcher. Currently it does not match operators such as new delete. FIXME: figure out why these do not match?
Example matches both operator<<((o << b), c) and operator<<(o, b) (matcher = cxxOperatorCallExpr())
See also the binaryOperation() matcher for more-general matching of binary uses of this AST node.
Definition at line 921 of file ASTMatchersInternal.cpp.
Referenced by AST_POLYMORPHIC_MATCHER_P2(), gtestCallInternal(), and gtestThatInternal().
const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl > clang::ast_matchers::cxxRecordDecl |
Matches C++ class declarations.
Example matches X
, Z
Definition at line 773 of file ASTMatchersInternal.cpp.
Referenced by AST_MATCHER_FUNCTION(), getComparisonDecl(), isExactClass(), clang::tooling::isKnownPointerLikeType(), isSubclass(), and clang::dataflow::UncheckedOptionalAccessModel::optionalClassDecl().
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXReinterpretCastExpr > clang::ast_matchers::cxxReinterpretCastExpr |
Matches a reinterpret_cast expression.
Either the source expression or the destination type can be matched using has(), but hasDestinationType() is more specific and can be more readable.
Example matches reinterpret_cast<char*>(&p) in
Definition at line 1002 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXRewrittenBinaryOperator > clang::ast_matchers::cxxRewrittenBinaryOperator |
Matches rewritten binary operators.
Example matches use of "<":
See also the binaryOperation() matcher for more-general matching of this AST node.
Definition at line 923 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStaticCastExpr > clang::ast_matchers::cxxStaticCastExpr |
Matches a C++ static_cast expression.
Example: cxxStaticCastExpr() matches static_cast<long>(8) in
Definition at line 1004 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXStdInitializerListExpr > clang::ast_matchers::cxxStdInitializerListExpr |
Matches C++ initializer list expressions.
Given
cxxStdInitializerListExpr() matches "{ 1, 2, 3 }" and "{ 4, 5 }"
Definition at line 881 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTemporaryObjectExpr > clang::ast_matchers::cxxTemporaryObjectExpr |
Matches functional cast expressions having N != 1 arguments.
Example: Matches Foo(bar, bar)
Definition at line 1019 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThisExpr > clang::ast_matchers::cxxThisExpr |
Matches implicit and explicit this expressions.
Example matches the implicit this expression in "return i". (matcher = cxxThisExpr())
Definition at line 903 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXThrowExpr > clang::ast_matchers::cxxThrowExpr |
Matches throw expressions.
cxxThrowExpr() matches 'throw 5'
Definition at line 951 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXTryStmt > clang::ast_matchers::cxxTryStmt |
Matches try statements.
cxxTryStmt() matches 'try {}'
Definition at line 950 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXUnresolvedConstructExpr > clang::ast_matchers::cxxUnresolvedConstructExpr |
Matches unresolved constructor call expressions.
Example matches T(t) in return statement of f (matcher = cxxUnresolvedConstructExpr())
Definition at line 902 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< DecayedType > clang::ast_matchers::decayedType |
Matches decayed type Example matches i[] in declaration of f.
(matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType()))))) Example matches i[1]. (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
Definition at line 1108 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< Decl > clang::ast_matchers::decl |
Matches declarations.
Examples matches X
, C
, and the friend declaration inside C
;
Definition at line 762 of file ASTMatchersInternal.cpp.
Referenced by clang::Sema::ActOnForEachDeclStmt(), clang::SemaObjC::ActOnMethodDeclaration(), clang::SemaObjC::actOnObjCTypeArgsOrProtocolQualifiers(), AST_MATCHER_FUNCTION(), checkMethodFamilyMismatch(), checkTempObjectsInSamePool(), CXXRecordMembersNamed(), clang::CIRGen::CIRGenModule::emitGlobalDefinition(), clang::CIRGen::CIRGenModule::emitTopLevelDecl(), getInterestingTagDecl(), clang::ento::StoreManager::getLValueIvar(), clang::CodeGen::CodeGenModule::getMemberPointerConstant(), getTemplateOrInnerLocStart(), clang::ObjCInterfaceDecl::getTypeParamList(), cir::CIRGenerator::HandleTopLevelDecl(), hasOnlyNonStaticMemberFunctions(), clang::SemaObjC::inferObjCARCLifetime(), isAccessedBy(), clang::Sema::PopParsingDeclaration(), clang::ento::ExprEngine::ProcessInitializer(), clang::serialization::DataStreamBasicReader< Impl >::readLValuePathSerializationHelper(), clang::tryToFindPtrOrigin(), and clang::ASTDeclReader::VisitBlockDecl().
const internal::VariadicDynCastAllOfMatcher< Decl, DeclaratorDecl > clang::ast_matchers::declaratorDecl |
Matches declarator declarations (field, variable, function and non-type template parameter declarations).
Given
declaratorDecl() matches int
y.
Definition at line 783 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, DeclRefExpr > clang::ast_matchers::declRefExpr |
Matches expressions that refer to declarations.
Example matches x in if (x)
Definition at line 926 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::assignedToRef(), clang::ento::callByRef(), clang::ento::changeIntBoundNode(), findGadgets(), clang::ento::forLoopMatcher(), clang::ento::getAddrTo(), UPCPreIncrementGadget::matcher(), UUCAddAssignGadget::matcher(), DerefSimplePtrArithFixableGadget::matcher(), and clang::ento::simpleCondition().
Matches declaration statements.
Given
declStmt() matches 'int a'.
Definition at line 841 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::assignedToRef(), findGadgets(), and clang::ento::forLoopMatcher().
const AstTypeMatcher< DecltypeType > clang::ast_matchers::decltypeType |
Matches types nodes representing C++11 decltype(<expr>) types.
Given:
decltypeType() matches "decltype(i + j)"
Definition at line 1085 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, DecompositionDecl > clang::ast_matchers::decompositionDecl |
Matches decomposition-declarations.
Examples matches the declaration node with foo
and bar
, but not number
. (matcher = declStmt(has(decompositionDecl())))
Definition at line 763 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< DeducedTemplateSpecializationType > clang::ast_matchers::deducedTemplateSpecializationType |
Matches C++17 deduced template specialization types, e.g.
deduced class template types.
Given
deducedTemplateSpecializationType()
matches the type in the declaration of the variable c
.
Definition at line 1078 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, DefaultStmt > clang::ast_matchers::defaultStmt |
Matches default statements inside switch statements.
Given
defaultStmt() matches 'default:'.
Definition at line 945 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, DependentCoawaitExpr > clang::ast_matchers::dependentCoawaitExpr |
Matches co_await expressions where the type of the promise is dependent.
Definition at line 978 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< DependentSizedArrayType > clang::ast_matchers::dependentSizedArrayType |
Matches C++ arrays whose size is a value-dependent expression.
Given
dependentSizedArrayType() matches "T data[Size]"
Definition at line 1079 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< DependentSizedExtVectorType > clang::ast_matchers::dependentSizedExtVectorType |
Matches C++ extended vector type where either the type or size is dependent.
Given
dependentSizedExtVectorType() matches "T __attribute__((ext_vector_type(Size)))"
Definition at line 1080 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, DesignatedInitExpr > clang::ast_matchers::designatedInitExpr |
Matches C99 designated initializer expressions [C99 6.7.8].
Example: Matches { [2].y = 1.0, [0].x = 1.0 }
Definition at line 1023 of file ASTMatchersInternal.cpp.
Matches do statements.
Given
doStmt() matches 'do {} while(true)'
Definition at line 934 of file ASTMatchersInternal.cpp.
const internal::VariadicOperatorMatcherFunc< 2, std::numeric_limits< unsigned >::max()> clang::ast_matchers::eachOf = {internal::DynTypedMatcher::VO_EachOf} |
Matches if any of the given matchers matches.
Unlike anyOf
, eachOf
will generate a match result for each matching submatcher.
For example, in:
The matcher:
will generate two results binding "v", the first of which binds the field declaration of a
, the second the field declaration of b
.
Usable as: Any Matcher
Definition at line 1026 of file ASTMatchersInternal.cpp.
Referenced by findAll(), findGadgets(), and isInUnspecifiedPointerContext().
const AstTypeMatcher< ElaboratedType > clang::ast_matchers::elaboratedType |
Matches types specified with an elaborated type keyword or with a qualified name.
Given
elaboratedType()
matches the type of the variable declarations of both c
and d
.
Definition at line 1103 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< TypeLoc, ElaboratedTypeLoc > clang::ast_matchers::elaboratedTypeLoc |
Matches C or C++ elaborated TypeLoc
s.
Given
elaboratedTypeLoc() matches the TypeLoc
of the variable declaration of ss
.
Definition at line 814 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, EnumConstantDecl > clang::ast_matchers::enumConstantDecl |
Matches enum constants.
Example matches A, B, C
Definition at line 826 of file ASTMatchersInternal.cpp.
Matches enum declarations.
Example matches X
Definition at line 824 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< EnumType > clang::ast_matchers::enumType |
Matches enum types.
Given
enumType()
matches the type of the variable declarations of both c
and s
.
Definition at line 1098 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ExplicitCastExpr > clang::ast_matchers::explicitCastExpr |
Matches explicit cast expressions.
Matches any cast expression written in user code, whether it be a C-style cast, a functional-style cast, or a keyword cast.
Does not match implicit conversions.
Note: the name "explicitCast" is chosen to match Clang's terminology, as Clang uses the term "cast" to apply to implicit conversions as well as to actual cast expressions.
Example: matches all five of the casts in
but does not match the implicit conversion in
Definition at line 1012 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ExportDecl > clang::ast_matchers::exportDecl |
Matches any export declaration.
Example matches following declarations.
Definition at line 818 of file ASTMatchersInternal.cpp.
Matches expressions.
Example matches x()
Definition at line 925 of file ASTMatchersInternal.cpp.
Referenced by clang::Sema::ActOnFileScopeAsmDecl(), AST_MATCHER_FUNCTION(), AST_POLYMORPHIC_MATCHER_P2(), clang::ento::SValBuilder::conjureSymbol(), emitPointerArithmetic(), clang::Expr::findBoundMemberType(), clang::CodeGen::CGCXXABI::GetArrayCookieSize(), getDereferenceExpr(), getIncrementedVar(), clang::ento::SValBuilder::getMetadataSymbolVal(), gtestThatInternal(), isInUnspecifiedLvalueContext(), clang::ExprMutationAnalyzer::isUnevaluated(), clang::ento::SValBuilder::makeLoc(), UPCPreIncrementGadget::matcher(), UUCAddAssignGadget::matcher(), DerefSimplePtrArithFixableGadget::matcher(), clang::CodeGen::CGCXXABI::ReadArrayCookie(), clang::CodeGen::CGCXXABI::requiresArrayCookie(), clang::InitListExpr::setInit(), clang::CodeGen::CodeGenFunction::OpaqueValueMappingData::shouldBindAsLValue(), clang::CodeGen::CodeGenFunction::OpaqueValueMapping::shouldBindAsLValue(), and clang::InitListExpr::updateInit().
const internal::VariadicDynCastAllOfMatcher< Stmt, ExprWithCleanups > clang::ast_matchers::exprWithCleanups |
Matches expressions that introduce cleanups to be run at the end of the sub-expression's evaluation.
Example matches std::string()
Definition at line 878 of file ASTMatchersInternal.cpp.
Matches field declarations.
Given
fieldDecl() matches 'm'.
Definition at line 833 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, FixedPointLiteral > clang::ast_matchers::fixedPointLiteral |
Matches fixed point literals.
Definition at line 965 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, FloatingLiteral > clang::ast_matchers::floatLiteral |
Matches float literals of all sizes / encodings, e.g.
1.0, 1.0f, 1.0L and 1e10.
Does not match implicit conversions such as
Definition at line 962 of file ASTMatchersInternal.cpp.
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachMatcher > clang::ast_matchers::forEach |
Matches AST nodes that have child AST nodes that match the provided matcher.
Example matches X, Y, Y::X, Z::Y, Z::Y::X (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
ChildT must be an AST base type.
As opposed to 'has', 'forEach' will cause a match for each result that matches instead of only on the first one.
Usable as: Any Matcher
Definition at line 1051 of file ASTMatchersInternal.cpp.
Referenced by isInUnspecifiedUntypedContext().
const internal::ArgumentAdaptingMatcherFunc< internal::ForEachDescendantMatcher > clang::ast_matchers::forEachDescendant = {} |
Matches AST nodes that have descendant AST nodes that match the provided matcher.
Example matches X, A, A::X, B, B::C, B::C::X (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
DescendantT must be an AST base type.
As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for each result that matches instead of only on the first one.
Note: Recursively combined ForEachDescendant can cause many matches: cxxRecordDecl(forEachDescendant(cxxRecordDecl( forEachDescendant(cxxRecordDecl()) ))) will match 10 times (plus injected class name matches) on:
Usable as: Any Matcher
Definition at line 1054 of file ASTMatchersInternal.cpp.
Referenced by findAll().
Matches for statements.
Example matches 'for (;;) {}'
Definition at line 930 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::forLoopMatcher().
const internal::VariadicDynCastAllOfMatcher< Decl, FriendDecl > clang::ast_matchers::friendDecl |
Matches friend declarations.
Given
friendDecl() matches 'friend void foo()'.
Definition at line 839 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionDecl > clang::ast_matchers::functionDecl |
Matches function declarations.
Example matches f
Definition at line 836 of file ASTMatchersInternal.cpp.
Referenced by AST_MATCHER_FUNCTION(), AST_POLYMORPHIC_MATCHER_P2(), callsNames(), checkTempObjectsInNoPool(), getComparisonDecl(), getRunLoopRunM(), gtestCallInternal(), gtestThatInternal(), hasUnguardedAccess(), and isInUnspecifiedPointerContext().
const AstTypeMatcher< FunctionProtoType > clang::ast_matchers::functionProtoType |
Matches FunctionProtoType
nodes.
Given
functionProtoType() matches "int (*f)(int)" and the type of "g" in C++ mode. In C mode, "g" is not matched because it does not contain a prototype.
Definition at line 1087 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, FunctionTemplateDecl > clang::ast_matchers::functionTemplateDecl |
Matches C++ function template declarations.
Example matches f
Definition at line 838 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< FunctionType > clang::ast_matchers::functionType |
Matches FunctionType
nodes.
Given
functionType() matches "int (*f)(int)" and the type of "g".
Definition at line 1086 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, GenericSelectionExpr > clang::ast_matchers::genericSelectionExpr |
Matches C11 _Generic expression.
Definition at line 983 of file ASTMatchersInternal.cpp.
Referenced by clang::ExprMutationAnalyzer::isUnevaluated().
const internal::VariadicDynCastAllOfMatcher< Stmt, GNUNullExpr > clang::ast_matchers::gnuNullExpr |
Matches GNU __null expression.
Definition at line 981 of file ASTMatchersInternal.cpp.
Referenced by AST_MATCHER_FUNCTION().
Matches goto statements.
Given
gotoStmt() matches 'goto FOO'
Definition at line 939 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::hasSuspiciousStmt().
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > clang::ast_matchers::has = {} |
Matches AST nodes that have child AST nodes that match the provided matcher.
Example matches X, Y (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
ChildT must be an AST base type.
Usable as: Any Matcher Note that has is direct matcher, so it also matches things like implicit casts and paren casts. If you are matching with expr then you should probably consider using ignoringParenImpCasts like: has(ignoringParenImpCasts(expr())).
Definition at line 1048 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::assignedToRef(), and getLiteralInfo().
const internal::ArgumentAdaptingMatcherFunc< internal::HasAncestorMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > clang::ast_matchers::hasAncestor = {} |
Matches AST nodes that have an ancestor that matches the provided matcher.
Given
expr
(integerLiteral(hasAncestor(ifStmt()))) matches 42
, but not 43.
Usable as: Any Matcher
Definition at line 1064 of file ASTMatchersInternal.cpp.
Referenced by AST_MATCHER_FUNCTION(), checkTempObjectsInNoPool(), checkTempObjectsInSamePool(), and clang::ExprMutationAnalyzer::isUnevaluated().
const internal::VariadicFunction< internal::Matcher< NamedDecl >, StringRef, internal::hasAnyNameFunc > clang::ast_matchers::hasAnyName = {} |
Matches NamedDecl nodes that have any of the specified names.
This matcher is only provided as a performance optimization of hasName.
is equivalent to, but faster than
Definition at line 1037 of file ASTMatchersInternal.cpp.
Referenced by callsNames(), hasUnguardedAccess(), and clang::tooling::isKnownPointerLikeType().
const internal::VariadicFunction< internal::HasOpNameMatcher, StringRef, internal::hasAnyOperatorNameFunc > clang::ast_matchers::hasAnyOperatorName = {} |
Matches operator expressions (binary or unary) that have any of the specified names.
hasAnyOperatorName("+", "-") Is equivalent to anyOf(hasOperatorName("+"), hasOperatorName("-"))
Definition at line 1041 of file ASTMatchersInternal.cpp.
Referenced by isInUnspecifiedLvalueContext(), and isInUnspecifiedPointerContext().
const internal::VariadicFunction< internal::HasOverloadOpNameMatcher, StringRef, internal::hasAnyOverloadedOperatorNameFunc > clang::ast_matchers::hasAnyOverloadedOperatorName = {} |
Matches overloaded operator names.
Matches overloaded operator names specified in strings without the "operator" prefix: e.g. "<<".
hasAnyOverloadedOperatorName("+", "-") Is equivalent to anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
Definition at line 1044 of file ASTMatchersInternal.cpp.
const internal::VariadicFunction< internal::Matcher< ObjCMessageExpr >, StringRef, internal::hasAnySelectorFunc > clang::ast_matchers::hasAnySelector = {} |
Matches when at least one of the supplied string equals to the Selector.getAsString()
matcher = objCMessageExpr(hasSelector("methodA:", "methodB:")); matches both of the expressions below:
Definition at line 1047 of file ASTMatchersInternal.cpp.
const internal::ArgumentAdaptingMatcherFunc< internal::HasDescendantMatcher > clang::ast_matchers::hasDescendant = {} |
Matches AST nodes that have descendant AST nodes that match the provided matcher.
Example matches X, Y, Z (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
DescendantT must be an AST base type.
Usable as: Any Matcher
Definition at line 1050 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::assignedToRef(), checkTempObjectsInNoPool(), checkTempObjectsInSamePool(), clang::ento::getWidenedLoopState(), clang::ento::hasSuspiciousStmt(), hasUnguardedAccess(), clang::ExprMutationAnalyzer::isUnevaluated(), and potentiallyWritesIntoIvar().
const internal::ArgumentAdaptingMatcherFunc< internal::HasParentMatcher, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr >, internal::TypeList< Decl, NestedNameSpecifierLoc, Stmt, TypeLoc, Attr > > clang::ast_matchers::hasParent = {} |
Matches AST nodes that have a parent that matches the provided matcher.
Given
compoundStmt
(hasParent(ifStmt())) matches "{ int x = 43; }".
Usable as: Any Matcher
Definition at line 1059 of file ASTMatchersInternal.cpp.
Referenced by AST_MATCHER_FUNCTION().
Matches if statements.
Example matches 'if (x) {}'
Definition at line 929 of file ASTMatchersInternal.cpp.
Referenced by hasUnguardedAccess(), and isInUnspecifiedUntypedContext().
const internal::VariadicDynCastAllOfMatcher< Stmt, ImaginaryLiteral > clang::ast_matchers::imaginaryLiteral |
Matches imaginary literals, which are based on integer and floating point literals e.g.: 1i, 1.0i.
Definition at line 963 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitCastExpr > clang::ast_matchers::implicitCastExpr |
Matches the implicit cast nodes of Clang's AST.
This matches many different places, including function call return value eliding, as well as any type conversions.
Definition at line 1014 of file ASTMatchersInternal.cpp.
Referenced by isInUnspecifiedLvalueContext().
const internal::VariadicDynCastAllOfMatcher< Stmt, ImplicitValueInitExpr > clang::ast_matchers::implicitValueInitExpr |
Matches implicit initializers of init list expressions.
Given
implicitValueInitExpr() matches "[0].y" (implicitly)
Definition at line 883 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< IncompleteArrayType > clang::ast_matchers::incompleteArrayType |
Matches C arrays with unspecified size.
Given
incompleteArrayType() matches "int a[]" and "int c[]"
Definition at line 1081 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, IndirectFieldDecl > clang::ast_matchers::indirectFieldDecl |
Matches indirect field declarations.
Given
indirectFieldDecl() matches 'a'.
Definition at line 835 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, InitListExpr > clang::ast_matchers::initListExpr |
Matches init list expressions.
Given
initListExpr() matches "{ 1, 2 }" and "{ 5, 6 }"
Definition at line 879 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::assignedToRef().
const AstTypeMatcher< InjectedClassNameType > clang::ast_matchers::injectedClassNameType |
Matches injected class name types.
Example matches S s, but not S<T> s. (matcher = parmVarDecl(hasType(injectedClassNameType())))
Definition at line 1107 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, IntegerLiteral > clang::ast_matchers::integerLiteral |
Matches integer literals of all sizes / encodings, e.g.
1, 1L, 0x1 and 1U.
Does not match character-encoded integers such as L'a'.
Definition at line 961 of file ASTMatchersInternal.cpp.
Referenced by AST_MATCHER_FUNCTION(), clang::ento::forLoopMatcher(), DerefSimplePtrArithFixableGadget::matcher(), and clang::ento::simpleCondition().
const internal::MapAnyOfMatcher< CallExpr, CXXConstructExpr > clang::ast_matchers::invocation |
Matches function calls and constructor calls.
Because CallExpr and CXXConstructExpr do not share a common base class with API accessing arguments etc, AST Matchers for code which should match both are typically duplicated. This matcher removes the need for duplication.
Given code
The matcher
matches the expression in both doCall and doConstruct
Definition at line 991 of file ASTMatchersInternal.cpp.
Matches a declaration of label.
Given
labelDecl() matches 'FOO:'
Definition at line 768 of file ASTMatchersInternal.cpp.
Matches label statements.
Given
labelStmt() matches 'FOO:'
Definition at line 940 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< LambdaCapture > clang::ast_matchers::lambdaCapture |
Matches lambda captures.
Given
In the matcher lambdaExpr(hasAnyCapture(lambdaCapture()))
, lambdaCapture()
matches x
and x=1
.
Definition at line 799 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, LambdaExpr > clang::ast_matchers::lambdaExpr |
Matches lambda expressions.
Example matches [&](){return 5;}
Definition at line 848 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, LinkageSpecDecl > clang::ast_matchers::linkageSpecDecl |
Matches a declaration of a linkage specification.
Given
linkageSpecDecl() matches "extern "C" {}"
Definition at line 766 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< LValueReferenceType > clang::ast_matchers::lValueReferenceType |
Matches lvalue reference types.
Given:
lValueReferenceType()
matches the types of b
, d
, and e
. e
is matched since the type is deduced as int& by reference collapsing rules.
Definition at line 1095 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< MacroQualifiedType > clang::ast_matchers::macroQualifiedType |
Matches qualified types when the qualifier is applied via a macro.
Given
macroQualifiedType() matches the type of the typedef declaration of X
but not Y
.
Definition at line 1090 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, MaterializeTemporaryExpr > clang::ast_matchers::materializeTemporaryExpr |
Matches nodes where temporaries are materialized.
Example: Given
materializeTemporaryExpr() matches 'f()' in these statements
but does not match
Definition at line 907 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, MemberExpr > clang::ast_matchers::memberExpr |
Matches member expressions.
Given
memberExpr() matches this->x, x, y.x, a, this->b
Definition at line 842 of file ASTMatchersInternal.cpp.
Referenced by hasUnguardedAccess().
const AstTypeMatcher< MemberPointerType > clang::ast_matchers::memberPointerType |
Matches member pointer types.
Given
memberPointerType() matches "A::* ptr"
Definition at line 1091 of file ASTMatchersInternal.cpp.
Matches a declaration of anything that could have a name.
Example matches X
, S
, the anonymous union type, i
, and U
;
Definition at line 767 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceAliasDecl > clang::ast_matchers::namespaceAliasDecl |
Matches a declaration of a namespace alias.
Given
namespaceAliasDecl() matches "namespace alias" but not "namespace test"
Definition at line 771 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, NamespaceDecl > clang::ast_matchers::namespaceDecl |
Matches a declaration of a namespace.
Given
namespaceDecl() matches "namespace {}" and "namespace test {}"
Definition at line 769 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< NestedNameSpecifier > clang::ast_matchers::nestedNameSpecifier |
Matches nested name specifiers.
Given
nestedNameSpecifier() matches "ns::" and both "A::"
Definition at line 1067 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< NestedNameSpecifierLoc > clang::ast_matchers::nestedNameSpecifierLoc |
Same as nestedNameSpecifier
but matches NestedNameSpecifierLoc
.
Definition at line 1069 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, NonTypeTemplateParmDecl > clang::ast_matchers::nonTypeTemplateParmDecl |
Matches non-type template parameter declarations.
Given
nonTypeTemplateParmDecl() matches 'N', but not 'T'.
Definition at line 793 of file ASTMatchersInternal.cpp.
Matches null statements.
nullStmt() matches the second ';'
Definition at line 952 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtCatchStmt > clang::ast_matchers::objcCatchStmt |
Matches Objective-C @catch statements.
Example matches @catch
Definition at line 874 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryDecl > clang::ast_matchers::objcCategoryDecl |
Matches Objective-C category declarations.
Example matches Foo (Additions)
Definition at line 860 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCCategoryImplDecl > clang::ast_matchers::objcCategoryImplDecl |
Matches Objective-C category definitions.
Example matches Foo (Additions)
Definition at line 862 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtFinallyStmt > clang::ast_matchers::objcFinallyStmt |
Matches Objective-C @finally statements.
Example matches @finally
Definition at line 876 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCImplementationDecl > clang::ast_matchers::objcImplementationDecl |
Matches Objective-C implementation declarations.
Example matches Foo
Definition at line 856 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCInterfaceDecl > clang::ast_matchers::objcInterfaceDecl |
Matches Objective-C interface declarations.
Example matches Foo
Definition at line 854 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCIvarDecl > clang::ast_matchers::objcIvarDecl |
Matches Objective-C instance variable declarations.
Example matches _enabled
Definition at line 867 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCIvarRefExpr > clang::ast_matchers::objcIvarRefExpr |
Matches a reference to an ObjCIvar.
Example: matches "a" in "init" method:
Definition at line 927 of file ASTMatchersInternal.cpp.
Referenced by potentiallyWritesIntoIvar().
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCMessageExpr > clang::ast_matchers::objcMessageExpr |
Matches ObjectiveC Message invocation expressions.
The innermost message send invokes the "alloc" class method on the NSString class, while the outermost message send invokes the "initWithString" instance method on the object returned from NSString's "alloc". This matcher should match both message sends.
Definition at line 852 of file ASTMatchersInternal.cpp.
Referenced by getOtherMessageSentM(), and getRunLoopRunM().
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCMethodDecl > clang::ast_matchers::objcMethodDecl |
Matches Objective-C method declarations.
Example matches both declaration and definition of -[Foo method]
Definition at line 864 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< ObjCObjectPointerType > clang::ast_matchers::objcObjectPointerType |
Matches an Objective-C object pointer type, which is different from a pointer type, despite being syntactically similar.
Given
pointerType() matches "Foo *f", but does not match "int *a".
Definition at line 1093 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCPropertyDecl > clang::ast_matchers::objcPropertyDecl |
Matches Objective-C property declarations.
Example matches enabled
Definition at line 869 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ObjCProtocolDecl > clang::ast_matchers::objcProtocolDecl |
Matches Objective-C protocol declarations.
Example matches FooDelegate
Definition at line 858 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCStringLiteral > clang::ast_matchers::objcStringLiteral |
Matches ObjectiveC String literal expressions.
Example matches "abcd" @code NSString *s = @"abcd";
Definition at line 957 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtThrowStmt > clang::ast_matchers::objcThrowStmt |
Matches Objective-C @throw statements.
Example matches @throw
Definition at line 871 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ObjCAtTryStmt > clang::ast_matchers::objcTryStmt |
Matches Objective-C @try statements.
Example matches @try
Definition at line 872 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< OMPClause, OMPDefaultClause > clang::ast_matchers::ompDefaultClause |
Matches OpenMP default
clause.
Given
ompDefaultClause()
matches default(none)
, default(shared)
, default(private)
and default(firstprivate)
Definition at line 1123 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, OMPExecutableDirective > clang::ast_matchers::ompExecutableDirective |
Matches any #pragma omp
executable directive.
Given
ompExecutableDirective()
matches omp parallel
, omp parallel default(none)
and omp taskyield
.
Definition at line 1121 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, OpaqueValueExpr > clang::ast_matchers::opaqueValueExpr |
Matches opaque value expressions.
They are used as helpers to reference another expressions and can be met in BinaryConditionalOperators, for example.
Example matches 'a'
Definition at line 998 of file ASTMatchersInternal.cpp.
const internal::VariadicOperatorMatcherFunc< 1, 1 > clang::ast_matchers::optionally |
Matches any node regardless of the submatcher.
However, optionally
will retain any bindings generated by the submatcher. Useful when additional information which may or may not present about a main matching node is desired.
For example, in:
The matcher:
will produce a result binding for both "record" and "var". The matcher will produce a "record" binding for even if there is no data member named "bar" in that class.
Usable as: Any Matcher
Definition at line 1033 of file ASTMatchersInternal.cpp.
Matches parentheses used in expressions.
Example matches (foo() + 1)
Definition at line 898 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ParenListExpr > clang::ast_matchers::parenListExpr |
Matches paren list expressions.
ParenListExprs don't have a predefined type and are used for late parsing. In the final AST, they can be met in template declarations.
Given
parenListExpr() matches "*this" but NOT matches (a, b) because (a, b) has a predefined type and is a ParenExpr, not a ParenListExpr.
Definition at line 884 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< ParenType > clang::ast_matchers::parenType |
Matches ParenType
nodes.
Given
varDecl
(hasType(pointsTo(parenType()))) matches ptr_to_array
but not array_of_ptrs
.
Definition at line 1088 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, ParmVarDecl > clang::ast_matchers::parmVarDecl |
Matches parameter variable declarations.
Given
parmVarDecl() matches int
x.
Definition at line 784 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::callByRef().
const AstTypeMatcher< PointerType > clang::ast_matchers::pointerType |
Matches pointer types, but does not match Objective-C object pointer types.
Given
pointerType() matches "int *a", but does not match "Foo *f".
Definition at line 1092 of file ASTMatchersInternal.cpp.
Referenced by clang::SemaObjC::ActOnObjCAtSynchronizedOperand(), AST_MATCHER_FUNCTION(), clang::Sema::BuildAtomicExpr(), clang::SemaARM::CheckARMBuiltinExclusiveCall(), CheckNonNullArguments(), clang::SemaObjC::CheckObjCForCollectionOperand(), emitPointerArithmetic(), hasPointerType(), and hasTypePointingTo().
const internal::VariadicDynCastAllOfMatcher< TypeLoc, PointerTypeLoc > clang::ast_matchers::pointerTypeLoc |
Matches pointer TypeLoc
s.
Given
pointerTypeLoc() matches int*
.
Definition at line 807 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, PredefinedExpr > clang::ast_matchers::predefinedExpr |
Matches predefined identifier expressions [C99 6.4.2.2].
Example: Matches func
Definition at line 1021 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< TypeLoc, QualifiedTypeLoc > clang::ast_matchers::qualifiedTypeLoc |
Matches QualifiedTypeLoc
s in the clang AST.
Given
qualifiedTypeLoc() matches const int
.
Definition at line 805 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< QualType > clang::ast_matchers::qualType |
Matches QualTypes
in the clang AST.
Definition at line 800 of file ASTMatchersInternal.cpp.
Referenced by AST_MATCHER_P_OVERLOAD(), AST_POLYMORPHIC_MATCHER_P_OVERLOAD(), and clang::ento::callByRef().
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > clang::ast_matchers::recordDecl |
Matches class, struct, and union declarations.
Example matches X
, Z
, U
, and S
Definition at line 772 of file ASTMatchersInternal.cpp.
Referenced by classifyPointerDeclarator(), clang::serialization::DataStreamBasicReader< Impl >::readLValuePathSerializationHelper(), and clang::serialization::DataStreamBasicWriter< Impl >::writeLValuePathSerializationHelper().
const AstTypeMatcher< RecordType > clang::ast_matchers::recordType |
Matches record types (e.g.
structs, classes).
Given
recordType()
matches the type of the variable declarations of both c
and s
.
Definition at line 1101 of file ASTMatchersInternal.cpp.
Referenced by clang::Sema::BuildExceptionDeclaration(), clang::Sema::CheckCompleteVariableDeclaration(), classifyPointerDeclarator(), classifyType(), clang::tooling::isKnownPointerLikeType(), and isSafeForCXXConstantCapture().
const AstTypeMatcher< ReferenceType > clang::ast_matchers::referenceType |
Matches both lvalue and rvalue reference types.
Given
referenceType()
matches the types of b
, c
, d
, e
, and f
.
Definition at line 1094 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::assignedToRef(), and clang::ento::getWidenedLoopState().
const internal::VariadicDynCastAllOfMatcher< TypeLoc, ReferenceTypeLoc > clang::ast_matchers::referenceTypeLoc |
Matches reference TypeLoc
s.
Given
referenceTypeLoc() matches int&
and int&&
.
Definition at line 809 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, ReturnStmt > clang::ast_matchers::returnStmt |
Matches return statements.
Given
returnStmt() matches 'return 1'
Definition at line 938 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::hasSuspiciousStmt().
const AstTypeMatcher< RValueReferenceType > clang::ast_matchers::rValueReferenceType |
Matches rvalue reference types.
Given:
rValueReferenceType()
matches the types of c
and f
. e
is not matched as it is deduced to int& by reference collapsing rules.
Definition at line 1096 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, StaticAssertDecl > clang::ast_matchers::staticAssertDecl |
Matches a C++ static_assert declaration.
Example: staticAssertDecl() matches static_assert(sizeof(S) == sizeof(int)) in
Definition at line 1000 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< Stmt > clang::ast_matchers::stmt |
Matches statements.
Given
stmt() matches both the compound statement '{ ++a; }' and '++a'.
Definition at line 840 of file ASTMatchersInternal.cpp.
Referenced by alignOfExpr(), clang::CFG::BuildOptions::alwaysAdd(), AST_MATCHER_FUNCTION(), clang::ento::SValBuilder::conjureSymbol(), clang::ento::SValBuilder::conjureSymbolVal(), findGadgets(), clang::AnalysisDeclContext::getBlockForRegisteredExpression(), clang::ento::getWidenedLoopState(), clang::ento::hasSuspiciousStmt(), hasUnguardedAccess(), isInUnspecifiedPointerContext(), isInUnspecifiedUntypedContext(), clang::ento::isPossiblyEscaped(), clang::ExprMutationAnalyzer::isUnevaluated(), UPCPreIncrementGadget::matcher(), UUCAddAssignGadget::matcher(), potentiallyWritesIntoIvar(), clang::AnalysisDeclContext::registerForcedBlockExpression(), sizeOfExpr(), and clang::CFG::VisitBlockStmts().
Matches statement expression (GNU extension).
Example match: ({ int X = 4; X; })
Definition at line 985 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, StringLiteral > clang::ast_matchers::stringLiteral |
Matches string literals (also matches wide string literals).
Example matches "abcd", L"abcd"
Definition at line 956 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, SubstNonTypeTemplateParmExpr > clang::ast_matchers::substNonTypeTemplateParmExpr |
Matches substitutions of non-type template parameters.
Given
substNonTypeTemplateParmExpr() matches "N" in the right-hand side of "static const int n = N;"
Definition at line 886 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< SubstTemplateTypeParmType > clang::ast_matchers::substTemplateTypeParmType |
Matches types that represent the result of substituting a type for a template type parameter.
Given
substTemplateTypeParmType()
matches the type of 't' but not '1'
Definition at line 1105 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchCase > clang::ast_matchers::switchCase |
Matches case and default statements inside switch statements.
Given
switchCase() matches 'case 42:' and 'default:'.
Definition at line 943 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, SwitchStmt > clang::ast_matchers::switchStmt |
Matches switch statements.
Given
switchStmt() matches 'switch(a)'.
Definition at line 942 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::hasSuspiciousStmt(), and hasUnguardedAccess().
const AstTypeMatcher< TagType > clang::ast_matchers::tagType |
Matches tag types (record and enum types).
Given
tagType()
matches the type of the variable declarations of both e
and c
.
Definition at line 1102 of file ASTMatchersInternal.cpp.
Referenced by clang::ASTContext::getCFConstantStringDecl().
const internal::VariadicAllOfMatcher< TemplateArgument > clang::ast_matchers::templateArgument |
Matches template arguments.
Given
templateArgument() matches 'int' in C<int>.
Definition at line 789 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< TemplateArgumentLoc > clang::ast_matchers::templateArgumentLoc |
Matches template arguments (with location info).
Given
templateArgumentLoc() matches 'int' in C<int>.
Definition at line 790 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< TemplateName > clang::ast_matchers::templateName |
Matches template name.
Given
templateName() matches 'X' in X<int>.
Definition at line 791 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< TemplateSpecializationType > clang::ast_matchers::templateSpecializationType |
Matches template specialization types.
Given
templateSpecializationType()
matches the type of the explicit instantiation in A
and the type of the variable declaration in B
.
Definition at line 1099 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< TypeLoc, TemplateSpecializationTypeLoc > clang::ast_matchers::templateSpecializationTypeLoc |
Matches template specialization TypeLoc
s.
Given
varDecl(hasTypeLoc(templateSpecializationTypeLoc(typeLoc()))) matches C<char> var
.
Definition at line 812 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTemplateParmDecl > clang::ast_matchers::templateTemplateParmDecl |
Matches template template parameter declarations.
Given
templateTypeParmDecl() matches 'Z', but not 'N'.
Definition at line 797 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, TemplateTypeParmDecl > clang::ast_matchers::templateTypeParmDecl |
Matches template type parameter declarations.
Given
templateTypeParmDecl() matches 'T', but not 'N'.
Definition at line 795 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< TemplateTypeParmType > clang::ast_matchers::templateTypeParmType |
Matches template type parameter types.
Example matches T, but not int. (matcher = templateTypeParmType())
Definition at line 1106 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, TranslationUnitDecl > clang::ast_matchers::translationUnitDecl |
Matches the top declaration context.
Given
decl(hasDeclContext(translationUnitDecl())) matches "int X", but not "int Y".
Definition at line 755 of file ASTMatchersInternal.cpp.
const internal::VariadicAllOfMatcher< Type > clang::ast_matchers::type |
Matches Types
in the clang AST.
Definition at line 801 of file ASTMatchersInternal.cpp.
Referenced by clang::Sema::ActOnForEachDeclStmt(), clang::Sema::ActOnIdExpression(), clang::SemaObjC::ActOnObjCAtSynchronizedOperand(), clang::SemaObjC::actOnObjCTypeArgsOrProtocolQualifiers(), clang::CodeGen::CallArgList::add(), addBlockLayout(), clang::Qualifiers::addObjCGCAttr(), clang::Qualifiers::addObjCLifetime(), clang::SemaSwift::AddParameterABIAttr(), clang::InitializationSequence::AddPassByIndirectCopyRestoreStep(), clang::CodeGen::ConstantAggregateBuilderBase::addPlaceholderWithSize(), clang::Sema::AddPushedVisibilityAttribute(), clang::CodeGen::ConstantAggregateBuilderBase::addRelativeOffset(), clang::CodeGen::ConstantAggregateBuilderBase::addRelativeOffsetToPosition(), clang::CodeGen::ConstantAggregateBuilderBase::addTaggedRelativeOffset(), clang::CodeGen::swiftcall::SwiftAggLowering::addTypedData(), clang::CodeGen::CallArgList::addUncopiedAggregate(), clang::ASTContext::applyObjCProtocolQualifiers(), clang::applyObjCTypeArgs(), breakDownVectorType(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildMemberReferenceExpr(), clang::SemaObjC::BuildObjCBoxedExpr(), clang::SemaPPC::BuiltinPPCMMACall(), clang::arcmt::trans::canApplyWeak(), clang::Type::canHaveNullability(), clang::Sema::CheckCompleteVariableDeclaration(), CheckNonNullArguments(), checkObjCKindOfType(), checkVarTypeForConstantEmission(), clang::CodeGen::swiftcall::classifyArgumentType(), classifyPointerDeclarator(), clang::CodeGen::swiftcall::classifyReturnType(), classifyType(), classifyTypeForARCConversion(), clang::SemaCodeCompletion::CodeCompleteCase(), clang::ento::SValBuilder::conjureSymbol(), clang::ento::SValBuilder::conjureSymbolVal(), clang::CIRGen::CIRGenTypes::convertType(), clang::IntegerLiteral::Create(), clang::UnaryOperator::Create(), clang::OffsetOfExpr::Create(), clang::PseudoObjectExpr::Create(), clang::FixedPointLiteral::CreateFromRawInt(), diagnoseBadTypeAttribute(), distributeFunctionTypeAttr(), distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), emitARCRetainLoadOfScalar(), emitAutoreleasedReturnValueMarker(), emitCXXDestructMethod(), EmitCXXNewAllocSize(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(), EmitDeclInit(), clang::CIRGen::CIRGenModule::emitGlobalVarDefinition(), emitPartialArrayDestroy(), clang::ento::SValBuilder::evalBinOp(), clang::CodeGen::ConstantAggregateBuilderBase::fillPlaceholderWithInt(), clang::Expr::findBoundMemberType(), clang::CodeGen::ConstantAggregateBuilderBase::finishArray(), clang::FixedPointLiteral::FixedPointLiteral(), clang::Sema::FixOverloadedFunctionReference(), clang::CodeGen::ConstantAggregateBuilderBase::getAddrOfCurrentPosition(), clang::CodeGen::ConstantAggregateBuilderBase::getAddrOfPosition(), getArrayDepth(), clang::ASTContext::getAttributedType(), clang::ASTContext::getBaseElementType(), clang::Type::getBaseElementTypeUnsafe(), getBaseMessageSendResultType(), clang::CodeGen::swiftcall::SwiftAggLowering::getCoerceAndExpandTypes(), getComplexType(), clang::ento::SValBuilder::getConjuredHeapSymbolVal(), getImpliedARCOwnership(), clang::ASTContext::getLifetimeQualifiedType(), clang::CodeGen::CodeGenModule::getMemberPointerConstant(), clang::ento::SValBuilder::getMetadataSymbolVal(), clang::CodeGen::swiftcall::getNaturalAlignment(), getNonMemoryType(), getNullForVariable(), clang::ASTContext::getObjCEncodingTypeSize(), clang::ASTContext::getObjCObjectType(), clang::Type::getPointeeOrArrayElementType(), getTypeAllocSize(), getTypeStoreSize(), clang::ASTContext::getUnqualifiedArrayType(), clang::ASTContext::getUnqualifiedObjCPointerType(), clang::ASTContext::getVariableArrayDecayedType(), clang::SemaObjC::handleBlocksAttr(), handleFunctionTypeAttr(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), handleObjCPointerTypeAttr(), handleVisibilityAttr(), hasWeakMember(), inferARCLifetimeForPointee(), clang::SemaObjC::inferObjCARCLifetime(), clang::IntegerLiteral::IntegerLiteral(), isConstantEmittableObjectType(), isFullSizeType(), isInAllocaArgument(), clang::tooling::isKnownPointerLikeType(), isMergeableEntryType(), isNonNullType(), clang::Type::isObjCLifetimeType(), clang::CodeGen::CodeGenModule::isPaddedAtomicType(), isPlaceholderToRemoveAsArg(), clang::isPtrOfType(), isSafeForCXXConstantCapture(), isTriviallyCopyableTypeImpl(), clang::SemaObjC::LookupMethodInObjectType(), clang::CodeGen::LValue::MakeAddr(), clang::CodeGen::LValue::MakeBitfield(), clang::ento::SValBuilder::makeCompoundVal(), clang::CodeGen::LValue::MakeExtVectorElt(), clang::sema::DelayedDiagnostic::makeForbiddenType(), clang::CodeGen::LValue::MakeGlobalReg(), clang::ento::SValBuilder::makeIntVal(), clang::CodeGen::LValue::MakeMatrixElt(), clang::ento::SValBuilder::makeNonLoc(), clang::ento::SValBuilder::makeNullWithType(), clang::ento::SValBuilder::makeTruthVal(), clang::CodeGen::LValue::MakeVectorElt(), clang::ento::SValBuilder::makeZeroVal(), mergeTypeNullabilityForRedecl(), clang::CodeGen::SwiftABIInfo::occupiesMoreThan(), clang::SemaObjC::PrepareCastToObjCObjectPointer(), processTypeAttrs(), PushPragmaVisibility(), clang::Sema::RequireCompleteDeclContext(), clang::Qualifiers::setObjCGCAttr(), clang::Qualifiers::setObjCLifetime(), clang::api_notes::VariableInfo::setType(), clang::QualifierCollector::strip(), tryCaptureAsConstant(), and tryEmitARCRetainLoadOfScalar().
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasDecl > clang::ast_matchers::typeAliasDecl |
Matches type alias declarations.
Given
typeAliasDecl() matches "using Y = int", but not "typedef int X"
Definition at line 759 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, TypeAliasTemplateDecl > clang::ast_matchers::typeAliasTemplateDecl |
Matches type alias template declarations.
typeAliasTemplateDecl() matches
Definition at line 761 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > clang::ast_matchers::typedefDecl |
Matches typedef declarations.
Given
typedefDecl() matches "typedef int X", but not "using Y = int"
Definition at line 756 of file ASTMatchersInternal.cpp.
Referenced by CheckNullabilityTypeSpecifier().
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefNameDecl > clang::ast_matchers::typedefNameDecl |
Matches typedef name declarations.
Given
typedefNameDecl() matches "typedef int X" and "using Y = int"
Definition at line 758 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< TypedefType > clang::ast_matchers::typedefType |
Matches typedef types.
Given
typedefType() matches "typedef int X"
Definition at line 1097 of file ASTMatchersInternal.cpp.
Referenced by clang::Type::isObjCIndependentClassType(), and clang::Type::isObjCNSObjectType().
const internal::VariadicAllOfMatcher< TypeLoc > clang::ast_matchers::typeLoc |
Matches TypeLocs
in the clang AST.
Definition at line 802 of file ASTMatchersInternal.cpp.
Referenced by clang::ExprMutationAnalyzer::isUnevaluated().
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryExprOrTypeTraitExpr > clang::ast_matchers::unaryExprOrTypeTraitExpr |
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
Given
unaryExprOrTypeTraitExpr() matches sizeof(x)
and alignof(x)
Definition at line 817 of file ASTMatchersInternal.cpp.
Referenced by alignOfExpr(), clang::ExprMutationAnalyzer::isUnevaluated(), and sizeOfExpr().
const internal::VariadicDynCastAllOfMatcher< Stmt, UnaryOperator > clang::ast_matchers::unaryOperator |
Matches unary operator expressions.
Example matches !a
Definition at line 992 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::changeIntBoundNode(), clang::ento::forLoopMatcher(), clang::ento::getAddrTo(), UPCPreIncrementGadget::matcher(), and DerefSimplePtrArithFixableGadget::matcher().
const AstTypeMatcher< UnaryTransformType > clang::ast_matchers::unaryTransformType |
Matches types nodes representing unary type transformations.
Given:
unaryTransformType() matches "__underlying_type(T)"
Definition at line 1100 of file ASTMatchersInternal.cpp.
const internal::VariadicOperatorMatcherFunc< 1, 1 > clang::ast_matchers::unless |
Matches if the provided matcher does not match.
Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
Usable as: Any Matcher
Definition at line 1065 of file ASTMatchersInternal.cpp.
Referenced by AST_POLYMORPHIC_MATCHER_P2(), clang::ento::callByRef(), checkTempObjectsInNoPool(), findGadgets(), clang::ento::forLoopMatcher(), getOtherMessageSentM(), isInUnspecifiedPointerContext(), and clang::ExprMutationAnalyzer::isUnevaluated().
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedLookupExpr > clang::ast_matchers::unresolvedLookupExpr |
Matches reference to a name that can be looked up during parsing but could not be resolved to a specific declaration.
Given
unresolvedLookupExpr() matches
Definition at line 892 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, UnresolvedMemberExpr > clang::ast_matchers::unresolvedMemberExpr |
Matches unresolved member expressions.
Given
unresolvedMemberExpr() matches x.f<T>
Definition at line 844 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingTypenameDecl > clang::ast_matchers::unresolvedUsingTypenameDecl |
Matches unresolved using value declarations that involve the typename.
Given
unresolvedUsingTypenameDecl() matches
Definition at line 896 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, UnresolvedUsingValueDecl > clang::ast_matchers::unresolvedUsingValueDecl |
Matches unresolved using value declarations.
Given
unresolvedUsingValueDecl() matches
Definition at line 894 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Stmt, UserDefinedLiteral > clang::ast_matchers::userDefinedLiteral |
Matches user defined literal operator call.
Example match: "foo"_suffix
Definition at line 967 of file ASTMatchersInternal.cpp.
Matches using declarations.
Given
usingDecl() matches
Definition at line 887 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingDirectiveDecl > clang::ast_matchers::usingDirectiveDecl |
Matches using namespace declarations.
Given
usingDirectiveDecl() matches
Definition at line 890 of file ASTMatchersInternal.cpp.
const internal::VariadicDynCastAllOfMatcher< Decl, UsingEnumDecl > clang::ast_matchers::usingEnumDecl |
Matches using-enum declarations.
Given
usingEnumDecl() matches
Definition at line 888 of file ASTMatchersInternal.cpp.
const AstTypeMatcher< UsingType > clang::ast_matchers::usingType |
Matches types specified through a using declaration.
Given
usingType()
matches the type of the variable declaration of s
.
Definition at line 1104 of file ASTMatchersInternal.cpp.
Matches any value declaration.
Example matches A, B, C and F
Definition at line 819 of file ASTMatchersInternal.cpp.
Referenced by clang::serialization::DataStreamBasicWriter< Impl >::writeLValuePathSerializationHelper().
Matches variable declarations.
Note: this does not match declarations of member variables, which are "field" declarations in Clang parlance.
Example matches a
Definition at line 832 of file ASTMatchersInternal.cpp.
Referenced by clang::ento::assignedToRef(), AST_MATCHER_FUNCTION(), clang::ento::callByRef(), clang::ento::changeIntBoundNode(), findGadgets(), clang::ento::forLoopMatcher(), clang::ento::getWidenedLoopState(), clang::ento::ExprEngine::ProcessAutomaticObjDtor(), and clang::ento::simpleCondition().
const AstTypeMatcher< VariableArrayType > clang::ast_matchers::variableArrayType |
Matches C arrays with a specified size that is not an integer-constant-expression.
Given
variableArrayType() matches "int c[a[0]]"
Definition at line 1082 of file ASTMatchersInternal.cpp.
Referenced by clang::ExprMutationAnalyzer::isUnevaluated().
Matches while statements.
Given
whileStmt() matches 'while (true) {}'.
Definition at line 933 of file ASTMatchersInternal.cpp.