aboutsummaryrefslogtreecommitdiffstats
path: root/src/Clazy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Clazy.cpp')
-rw-r--r--src/Clazy.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Clazy.cpp b/src/Clazy.cpp
index 5ef48ae0..c1ff2c67 100644
--- a/src/Clazy.cpp
+++ b/src/Clazy.cpp
@@ -61,14 +61,19 @@ static void manuallyPopulateParentMap(ParentMap *map, Stmt *s)
ClazyASTConsumer::ClazyASTConsumer(ClazyContext *context)
: m_context(context)
+ , m_matchFinder(nullptr)
{
clang::ast_matchers::MatchFinder::MatchFinderOptions options;
+#ifndef CLAZY_DISABLE_AST_MATCHERS
m_matchFinder = new clang::ast_matchers::MatchFinder(options);
+#endif
}
void ClazyASTConsumer::addCheck(CheckBase *check)
{
+#ifndef CLAZY_DISABLE_AST_MATCHERS
check->registerASTMatchers(*m_matchFinder);
+#endif
m_createdChecks.push_back(check);
}
@@ -134,8 +139,10 @@ void ClazyASTConsumer::HandleTranslationUnit(ASTContext &ctx)
// Run our RecursiveAstVisitor based checks:
TraverseDecl(ctx.getTranslationUnitDecl());
+#ifndef CLAZY_DISABLE_AST_MATCHERS
// Run our AstMatcher base checks:
m_matchFinder->matchAST(ctx);
+#endif
}
static bool parseArgument(const string &arg, vector<string> &args)