clang 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
clang::ast_matchers::dynamic::Registry Class Reference

#include "clang/ASTMatchers/Dynamic/Registry.h"

Public Member Functions

 Registry ()=delete
 

Static Public Member Functions

static ASTNodeKind nodeMatcherType (MatcherCtor)
 
static bool isBuilderMatcher (MatcherCtor Ctor)
 
static internal::MatcherDescriptorPtr buildMatcherCtor (MatcherCtor, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 
static std::optional< MatcherCtorlookupMatcherCtor (StringRef MatcherName)
 Look up a matcher in the registry by name,.
 
static std::vector< ArgKindgetAcceptedCompletionTypes (llvm::ArrayRef< std::pair< MatcherCtor, unsigned > > Context)
 Compute the list of completion types for Context.
 
static std::vector< MatcherCompletiongetMatcherCompletions (ArrayRef< ArgKind > AcceptedTypes)
 Compute the list of completions that match any of AcceptedTypes.
 
static VariantMatcher constructMatcher (MatcherCtor Ctor, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Construct a matcher from the registry.
 
static VariantMatcher constructBoundMatcher (MatcherCtor Ctor, SourceRange NameRange, StringRef BindID, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Construct a matcher from the registry and bind it.
 

Detailed Description

Definition at line 82 of file Registry.h.

Constructor & Destructor Documentation

◆ Registry()

clang::ast_matchers::dynamic::Registry::Registry ( )
delete

Member Function Documentation

◆ buildMatcherCtor()

internal::MatcherDescriptorPtr clang::ast_matchers::dynamic::Registry::buildMatcherCtor ( MatcherCtor  Ctor,
SourceRange  NameRange,
ArrayRef< ParserValue Args,
Diagnostics Error 
)
static

◆ constructBoundMatcher()

VariantMatcher clang::ast_matchers::dynamic::Registry::constructBoundMatcher ( MatcherCtor  Ctor,
SourceRange  NameRange,
StringRef  BindID,
ArrayRef< ParserValue Args,
Diagnostics Error 
)
static

Construct a matcher from the registry and bind it.

Similar the constructMatcher() above, but it then tries to bind the matcher to the specified BindID. If the matcher is not bindable, it sets an error in Error and returns a null matcher.

Definition at line 808 of file Registry.cpp.

References clang::Result, and clang::ast_matchers::dynamic::VariantMatcher::SingleMatcher().

◆ constructMatcher()

VariantMatcher clang::ast_matchers::dynamic::Registry::constructMatcher ( MatcherCtor  Ctor,
SourceRange  NameRange,
ArrayRef< ParserValue Args,
Diagnostics Error 
)
static

Construct a matcher from the registry.

Parameters
CtorThe matcher constructor to instantiate.
NameRangeThe location of the name in the matcher source. Useful for error reporting.
ArgsThe argument list for the matcher. The number and types of the values must be valid for the matcher requested. Otherwise, the function will return an error.
Returns
The matcher object constructed if no error was found. A null matcher if the number of arguments or argument types do not match the signature. In that case Error will contain the description of the error.

Definition at line 801 of file Registry.cpp.

References clang::ast_matchers::dynamic::internal::MatcherDescriptor::create().

◆ getAcceptedCompletionTypes()

std::vector< ArgKind > clang::ast_matchers::dynamic::Registry::getAcceptedCompletionTypes ( llvm::ArrayRef< std::pair< MatcherCtor, unsigned > >  Context)
static

Compute the list of completion types for Context.

Each element of Context represents a matcher invocation, going from outermost to innermost. Elements are pairs consisting of a reference to the matcher constructor and the index of the next element in the argument list of that matcher (or for the last element, the index of the completion point in the argument list). An empty list requests completion for the root matcher.

Definition at line 662 of file Registry.cpp.

References clang::ast_matchers::dynamic::internal::MatcherDescriptor::getArgKinds(), clang::ast_matchers::dynamic::internal::MatcherDescriptor::isConvertibleTo(), clang::ast_matchers::dynamic::internal::MatcherDescriptor::isVariadic(), Kind, and clang::ast_matchers::dynamic::ArgKind::MakeMatcherArg().

◆ getMatcherCompletions()

std::vector< MatcherCompletion > clang::ast_matchers::dynamic::Registry::getMatcherCompletions ( ArrayRef< ArgKind AcceptedTypes)
static

Compute the list of completions that match any of AcceptedTypes.

Parameters
AcceptedTypesAll types accepted for this completion.
Returns
All completions for the specified types. Completions should be valid when used in lookupMatcherCtor(). The matcher constructed from the return of lookupMatcherCtor() should be convertible to some type in AcceptedTypes.

Definition at line 696 of file Registry.cpp.

References clang::ast_matchers::dynamic::ArgKind::AK_Matcher, clang::ast_matchers::dynamic::ArgKind::AK_String, Kind, and clang::ast_matchers::dynamic::RegistryData.

◆ isBuilderMatcher()

bool clang::ast_matchers::dynamic::Registry::isBuilderMatcher ( MatcherCtor  Ctor)
static

◆ lookupMatcherCtor()

std::optional< MatcherCtor > clang::ast_matchers::dynamic::Registry::lookupMatcherCtor ( StringRef  MatcherName)
static

Look up a matcher in the registry by name,.

Returns
An opaque value which may be used to refer to the matcher constructor, or std::optional<MatcherCtor>() if not found.

Definition at line 640 of file Registry.cpp.

References clang::ast_matchers::dynamic::RegistryData.

◆ nodeMatcherType()

ASTNodeKind clang::ast_matchers::dynamic::Registry::nodeMatcherType ( MatcherCtor  Ctor)
static

The documentation for this class was generated from the following files: