Debian Codegraph @

src/ClazyVisitHelper.h

raw
1 /*
2 SPDX-FileCopyrightText: 2025 Alexander Lohnau <[email protected]>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5
6 #pragma once
7
8 #include "checkmanager.h"
9
10 namespace clazy::VisitHelper
11 {
12 struct Visitors {
13 CheckBase::List visitStmts;
14 CheckBase::List visitDecls;
15 CheckBase::List visitAllTypedefDecls;
16
17 void addCheck(RegisteredCheck::Options options, CheckBase *check)
18 {
19 if (options & RegisteredCheck::Option_VisitsStmts) {
20 visitStmts.emplace_back(check);
21 }
22 if (options & RegisteredCheck::Option_VisitsDecls) {
23 visitDecls.emplace_back(check);
24 }
25 if (options & RegisteredCheck::Option_VisitAllTypeDefs) {
26 visitAllTypedefDecls.push_back(check);
27 }
28 }
29 };
30
31 bool VisitDecl(clang::Decl *decl, ClazyContext *context, const Visitors &visitors);
32 bool VisitStmt(clang::Stmt *stmt, ClazyContext *context, const Visitors &visitors);
33 }