clang API Documentation
Interface to connect the parser with the registry and more. More...
#include <Parser.h>
Public Member Functions | |
virtual | ~Sema () |
virtual VariantMatcher | actOnMatcherExpression (MatcherCtor Ctor, const SourceRange &NameRange, StringRef BindID, ArrayRef< ParserValue > Args, Diagnostics *Error)=0 |
Process a matcher expression. | |
virtual llvm::Optional < MatcherCtor > | lookupMatcherCtor (StringRef MatcherName)=0 |
Look up a matcher by name. | |
virtual std::vector< ArgKind > | getAcceptedCompletionTypes (llvm::ArrayRef< std::pair< MatcherCtor, unsigned >> Context) |
Compute the list of completion types for Context . | |
virtual std::vector < MatcherCompletion > | getMatcherCompletions (llvm::ArrayRef< ArgKind > AcceptedTypes) |
Compute the list of completions that match any of AcceptedTypes . |
Interface to connect the parser with the registry and more.
The parser uses the Sema instance passed into parseMatcherExpression() to handle all matcher tokens. The simplest processor implementation would simply call into the registry to create the matchers. However, a more complex processor might decide to intercept the matcher creation and do some extra work. For example, it could apply some transformation to the matcher by adding some id() nodes, or could detect specific matcher nodes for more efficient lookup.
Definition at line 62 of file ASTMatchers/Dynamic/Parser.h.
clang::ast_matchers::dynamic::Parser::Sema::~Sema | ( | ) | [virtual] |
Definition at line 260 of file ASTMatchers/Dynamic/Parser.cpp.
virtual VariantMatcher clang::ast_matchers::dynamic::Parser::Sema::actOnMatcherExpression | ( | MatcherCtor | Ctor, |
const SourceRange & | NameRange, | ||
StringRef | BindID, | ||
ArrayRef< ParserValue > | Args, | ||
Diagnostics * | Error | ||
) | [pure virtual] |
Process a matcher expression.
All the arguments passed here have already been processed.
Ctor | A matcher constructor looked up by lookupMatcherCtor. |
NameRange | The location of the name in the matcher source. Useful for error reporting. |
BindID | The ID to use to bind the matcher, or a null StringRef if no ID is specified. |
Args | The argument list for the matcher. |
Error
will contain a description of the error. Implemented in clang::ast_matchers::dynamic::Parser::RegistrySema.
std::vector< ArgKind > clang::ast_matchers::dynamic::Parser::Sema::getAcceptedCompletionTypes | ( | llvm::ArrayRef< std::pair< MatcherCtor, unsigned >> | Context | ) | [virtual] |
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.
Reimplemented in clang::ast_matchers::dynamic::Parser::RegistrySema.
Definition at line 262 of file ASTMatchers/Dynamic/Parser.cpp.
std::vector< MatcherCompletion > clang::ast_matchers::dynamic::Parser::Sema::getMatcherCompletions | ( | llvm::ArrayRef< ArgKind > | AcceptedTypes | ) | [virtual] |
Compute the list of completions that match any of AcceptedTypes
.
AcceptedTypes | All types accepted for this completion. |
lookupMatcherCtor()
. The matcher constructed from the return of lookupMatcherCtor()
should be convertible to some type in AcceptedTypes
. Reimplemented in clang::ast_matchers::dynamic::Parser::RegistrySema.
Definition at line 268 of file ASTMatchers/Dynamic/Parser.cpp.
virtual llvm::Optional<MatcherCtor> clang::ast_matchers::dynamic::Parser::Sema::lookupMatcherCtor | ( | StringRef | MatcherName | ) | [pure virtual] |
Look up a matcher by name.
MatcherName | The matcher name found by the parser. |
Implemented in clang::ast_matchers::dynamic::Parser::RegistrySema.