clang 20.0.0git
|
A failable computation over nodes bound by AST matchers, with (limited) reflection via the toString
method.
More...
#include "clang/Tooling/Transformer/MatchConsumer.h"
Public Member Functions | |
virtual | ~MatchComputation ()=default |
virtual llvm::Error | eval (const ast_matchers::MatchFinder::MatchResult &Match, T *Result) const =0 |
Evaluates the computation and (potentially) updates the accumulator Result . | |
llvm::Expected< T > | eval (const ast_matchers::MatchFinder::MatchResult &R) const |
Convenience version of eval , for the case where the computation is being evaluated on its own. | |
virtual std::string | toString () const =0 |
Constructs a string representation of the computation, for informational purposes. | |
Protected Member Functions | |
MatchComputation ()=default | |
MatchComputation (const MatchComputation &)=default | |
MatchComputation & | operator= (const MatchComputation &)=default |
A failable computation over nodes bound by AST matchers, with (limited) reflection via the toString
method.
The computation should report any errors though its return value (rather than terminating the program) to enable usage in interactive scenarios like clang-query.
This is a central abstraction of the Transformer framework. It is a generalization of MatchConsumer
and intended to replace it.
Definition at line 64 of file MatchConsumer.h.
|
virtualdefault |
|
protecteddefault |
|
protecteddefault |
|
pure virtual |
Evaluates the computation and (potentially) updates the accumulator Result
.
Result
is undefined in the case of an error. Result
is an out parameter to optimize case where the computation involves composing the result of sub-computation evaluations.
llvm::Expected< T > clang::transformer::MatchComputation< T >::eval | ( | const ast_matchers::MatchFinder::MatchResult & | R | ) | const |
Convenience version of eval
, for the case where the computation is being evaluated on its own.
Definition at line 94 of file MatchConsumer.h.
References clang::T.
|
protecteddefault |
|
pure virtual |
Constructs a string representation of the computation, for informational purposes.
The representation must be deterministic, but is not required to be unique.