clang API Documentation

Static Public Member Functions
clang::ast_matchers::dynamic::Registry Class Reference

#include <Registry.h>

List of all members.

Static Public Member Functions

static llvm::Optional
< MatcherCtor
lookupMatcherCtor (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
< MatcherCompletion
getMatcherCompletions (ArrayRef< ArgKind > AcceptedTypes)
 Compute the list of completions that match any of AcceptedTypes.
static VariantMatcher constructMatcher (MatcherCtor Ctor, const SourceRange &NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Construct a matcher from the registry.
static VariantMatcher constructBoundMatcher (MatcherCtor Ctor, const SourceRange &NameRange, StringRef BindID, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Construct a matcher from the registry and bind it.

Detailed Description

Definition at line 62 of file Registry.h.


Member Function Documentation

VariantMatcher clang::ast_matchers::dynamic::Registry::constructBoundMatcher ( MatcherCtor  Ctor,
const 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 493 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().

VariantMatcher clang::ast_matchers::dynamic::Registry::constructMatcher ( MatcherCtor  Ctor,
const 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 485 of file Registry.cpp.

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

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

References Context, clang::ast_matchers::dynamic::internal::MatcherDescriptor::getArgKinds(), clang::ast_matchers::dynamic::internal::MatcherDescriptor::getNumArgs(), clang::ast_matchers::dynamic::internal::MatcherDescriptor::isConvertibleTo(), and clang::ast_matchers::dynamic::internal::MatcherDescriptor::isVariadic().

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

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


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