Debian Codegraph @

llvm-project/clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp

raw
1 //===--- AlteraTidyModule.cpp - clang-tidy --------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "../ClangTidy.h"
10 #include "../ClangTidyModule.h"
11 #include "../ClangTidyModuleRegistry.h"
12 #include "IdDependentBackwardBranchCheck.h"
13 #include "KernelNameRestrictionCheck.h"
14 #include "SingleWorkItemBarrierCheck.h"
15 #include "StructPackAlignCheck.h"
16 #include "UnrollLoopsCheck.h"
17
18 using namespace clang::ast_matchers;
19
20 namespace clang::tidy {
21 namespace altera {
22
23 class AlteraModule : public ClangTidyModule {
24 public:
25 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
26 CheckFactories.registerCheck<IdDependentBackwardBranchCheck>(
27 "altera-id-dependent-backward-branch");
28 CheckFactories.registerCheck<KernelNameRestrictionCheck>(
29 "altera-kernel-name-restriction");
30 CheckFactories.registerCheck<SingleWorkItemBarrierCheck>(
31 "altera-single-work-item-barrier");
32 CheckFactories.registerCheck<StructPackAlignCheck>(
33 "altera-struct-pack-align");
34 CheckFactories.registerCheck<UnrollLoopsCheck>("altera-unroll-loops");
35 }
36 };
37
38 } // namespace altera
39
40 // Register the AlteraTidyModule using this statically initialized variable.
41 static ClangTidyModuleRegistry::Add<altera::AlteraModule>
42 X("altera-module", "Adds Altera FPGA OpenCL lint checks.");
43
44 // This anchor is used to force the linker to link in the generated object file
45 // and thus register the AlteraModule.
46 volatile int AlteraModuleAnchorSource = 0;
47
48 } // namespace clang::tidy