clang  6.0.0svn
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 llvm::Optional< MatcherCtorlookupMatcherCtor (StringRef MatcherName)
 Look up a matcher in the registry by name,. More...
 
static std::vector< ArgKindgetAcceptedCompletionTypes (llvm::ArrayRef< std::pair< MatcherCtor, unsigned >> Context)
 Compute the list of completion types for Context. More...
 
static std::vector< MatcherCompletiongetMatcherCompletions (ArrayRef< ArgKind > AcceptedTypes)
 Compute the list of completions that match any of AcceptedTypes. More...
 
static VariantMatcher constructMatcher (MatcherCtor Ctor, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Construct a matcher from the registry. More...
 
static VariantMatcher constructBoundMatcher (MatcherCtor Ctor, SourceRange NameRange, StringRef BindID, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Construct a matcher from the registry and bind it. More...
 

Detailed Description

Definition at line 66 of file Registry.h.

Constructor & Destructor Documentation

◆ Registry()

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

Member Function Documentation

◆ 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 623 of file Registry.cpp.

References clang::ast_matchers::dynamic::Diagnostics::addError(), clang::ast_matchers::dynamic::Diagnostics::ET_RegistryNotBindable, clang::ast_matchers::dynamic::VariantMatcher::getSingleMatcher(), and clang::ast_matchers::dynamic::VariantMatcher::isNull().

Referenced by clang::ast_matchers::dynamic::Parser::RegistrySema::actOnMatcherExpression().

◆ 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 616 of file Registry.cpp.

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

Referenced by clang::ast_matchers::dynamic::Parser::RegistrySema::actOnMatcherExpression().

◆ 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 507 of file Registry.cpp.

◆ 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 538 of file Registry.cpp.

Referenced by clang::ast_matchers::dynamic::Parser::RegistrySema::getMatcherCompletions().

◆ lookupMatcherCtor()

llvm::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 Optional<MatcherCtor>() if not found.

Definition at line 484 of file Registry.cpp.

Referenced by clang::ast_matchers::dynamic::Parser::RegistrySema::lookupMatcherCtor().


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