diff options
-rw-r--r-- | src/Clazy.cpp | 7 | ||||
-rw-r--r-- | src/Clazy.h | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Clazy.cpp b/src/Clazy.cpp index 037316f9..5ef48ae0 100644 --- a/src/Clazy.cpp +++ b/src/Clazy.cpp @@ -62,17 +62,20 @@ static void manuallyPopulateParentMap(ParentMap *map, Stmt *s) ClazyASTConsumer::ClazyASTConsumer(ClazyContext *context) : m_context(context) { + clang::ast_matchers::MatchFinder::MatchFinderOptions options; + m_matchFinder = new clang::ast_matchers::MatchFinder(options); } void ClazyASTConsumer::addCheck(CheckBase *check) { - check->registerASTMatchers(m_matchFinder); + check->registerASTMatchers(*m_matchFinder); m_createdChecks.push_back(check); } ClazyASTConsumer::~ClazyASTConsumer() { delete m_context; + delete m_matchFinder; } bool ClazyASTConsumer::VisitDecl(Decl *decl) @@ -132,7 +135,7 @@ void ClazyASTConsumer::HandleTranslationUnit(ASTContext &ctx) TraverseDecl(ctx.getTranslationUnitDecl()); // Run our AstMatcher base checks: - m_matchFinder.matchAST(ctx); + m_matchFinder->matchAST(ctx); } static bool parseArgument(const string &arg, vector<string> &args) diff --git a/src/Clazy.h b/src/Clazy.h index 2c7c3b75..b80c9113 100644 --- a/src/Clazy.h +++ b/src/Clazy.h @@ -108,7 +108,7 @@ private: clang::Stmt *lastStm = nullptr; ClazyContext *const m_context; CheckBase::List m_createdChecks; - clang::ast_matchers::MatchFinder m_matchFinder; + clang::ast_matchers::MatchFinder *m_matchFinder = nullptr; }; #endif |