Debian Codegraph @

build/clang-plugin/CanRunScriptChecker.h

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef CanRunScriptChecker_h__
6 #define CanRunScriptChecker_h__
7
8 #include "plugin.h"
9 #include <unordered_set>
10
11 class CanRunScriptChecker : public BaseCheck {
12 public:
13 CanRunScriptChecker(StringRef CheckName, ContextType *Context = nullptr)
14 : BaseCheck(CheckName, Context) {}
15 void registerMatchers(MatchFinder *AstMatcher) override;
16 void check(const MatchFinder::MatchResult &Result) override;
17
18 // Simply initialize the can-run-script function set at the beginning of each
19 // translation unit.
20 void onStartOfTranslationUnit() override;
21
22 private:
23 /// Runs the inner matcher on the AST to find all the can-run-script
24 /// functions using custom rules (not only the annotation).
25 void buildFuncSet(ASTContext *Context);
26
27 bool IsFuncSetBuilt;
28 std::unordered_set<const FunctionDecl *> CanRunScriptFuncs;
29 };
30
31 #endif