#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Timer.h"
#include <deque>
#include <memory>
#include <set>
namespace clang {
namespace ast_matchers {
namespace internal {
namespace {
MatchCallback;
static const unsigned MaxMemoizationEntries = …;
enum class MatchType { … };
struct MatchKey { … };
struct MemoizedMatchResult { … };
class MatchChildASTVisitor
: public RecursiveASTVisitor<MatchChildASTVisitor> { … };
class MatchASTVisitor : public RecursiveASTVisitor<MatchASTVisitor>,
public ASTMatchFinder { … };
static CXXRecordDecl *
getAsCXXRecordDeclOrPrimaryTemplate(const Type *TypeNode) { … }
bool MatchASTVisitor::classIsDerivedFrom(const CXXRecordDecl *Declaration,
const Matcher<NamedDecl> &Base,
BoundNodesTreeBuilder *Builder,
bool Directly) { … }
bool MatchASTVisitor::classIsDerivedFromImpl(
const CXXRecordDecl *Declaration, const Matcher<NamedDecl> &Base,
BoundNodesTreeBuilder *Builder, bool Directly,
llvm::SmallPtrSetImpl<const CXXRecordDecl *> &Visited) { … }
bool MatchASTVisitor::objcClassIsDerivedFrom(
const ObjCInterfaceDecl *Declaration, const Matcher<NamedDecl> &Base,
BoundNodesTreeBuilder *Builder, bool Directly) { … }
bool MatchASTVisitor::TraverseDecl(Decl *DeclNode) { … }
bool MatchASTVisitor::TraverseStmt(Stmt *StmtNode, DataRecursionQueue *Queue) { … }
bool MatchASTVisitor::TraverseType(QualType TypeNode) { … }
bool MatchASTVisitor::TraverseTypeLoc(TypeLoc TypeLocNode) { … }
bool MatchASTVisitor::TraverseNestedNameSpecifier(NestedNameSpecifier *NNS) { … }
bool MatchASTVisitor::TraverseNestedNameSpecifierLoc(
NestedNameSpecifierLoc NNS) { … }
bool MatchASTVisitor::TraverseConstructorInitializer(
CXXCtorInitializer *CtorInit) { … }
bool MatchASTVisitor::TraverseTemplateArgumentLoc(TemplateArgumentLoc Loc) { … }
bool MatchASTVisitor::TraverseAttr(Attr *AttrNode) { … }
class MatchASTConsumer : public ASTConsumer { … };
}
}
MatchFinder::MatchResult::MatchResult(const BoundNodes &Nodes,
ASTContext *Context)
: … { … }
MatchFinder::MatchCallback::~MatchCallback() { … }
MatchFinder::ParsingDoneTestCallback::~ParsingDoneTestCallback() { … }
MatchFinder::MatchFinder(MatchFinderOptions Options)
: … { … }
MatchFinder::~MatchFinder() { … }
void MatchFinder::addMatcher(const DeclarationMatcher &NodeMatch,
MatchCallback *Action) { … }
void MatchFinder::addMatcher(const TypeMatcher &NodeMatch,
MatchCallback *Action) { … }
void MatchFinder::addMatcher(const StatementMatcher &NodeMatch,
MatchCallback *Action) { … }
void MatchFinder::addMatcher(const NestedNameSpecifierMatcher &NodeMatch,
MatchCallback *Action) { … }
void MatchFinder::addMatcher(const NestedNameSpecifierLocMatcher &NodeMatch,
MatchCallback *Action) { … }
void MatchFinder::addMatcher(const TypeLocMatcher &NodeMatch,
MatchCallback *Action) { … }
void MatchFinder::addMatcher(const CXXCtorInitializerMatcher &NodeMatch,
MatchCallback *Action) { … }
void MatchFinder::addMatcher(const TemplateArgumentLocMatcher &NodeMatch,
MatchCallback *Action) { … }
void MatchFinder::addMatcher(const AttrMatcher &AttrMatch,
MatchCallback *Action) { … }
bool MatchFinder::addDynamicMatcher(const internal::DynTypedMatcher &NodeMatch,
MatchCallback *Action) { … }
std::unique_ptr<ASTConsumer> MatchFinder::newASTConsumer() { … }
void MatchFinder::match(const clang::DynTypedNode &Node, ASTContext &Context) { … }
void MatchFinder::matchAST(ASTContext &Context) { … }
void MatchFinder::registerTestCallbackAfterParsing(
MatchFinder::ParsingDoneTestCallback *NewParsingDone) { … }
StringRef MatchFinder::MatchCallback::getID() const { … }
std::optional<TraversalKind>
MatchFinder::MatchCallback::getCheckTraversalKind() const { … }
}
}