• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "KernelNameRestrictionCheck.h"
13 #include "StructPackAlignCheck.h"
14 
15 using namespace clang::ast_matchers;
16 
17 namespace clang {
18 namespace tidy {
19 namespace altera {
20 
21 class AlteraModule : public ClangTidyModule {
22 public:
addCheckFactories(ClangTidyCheckFactories & CheckFactories)23   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
24     CheckFactories.registerCheck<KernelNameRestrictionCheck>(
25         "altera-kernel-name-restriction");
26     CheckFactories.registerCheck<StructPackAlignCheck>(
27         "altera-struct-pack-align");
28   }
29 };
30 
31 } // namespace altera
32 
33 // Register the AlteraTidyModule using this statically initialized variable.
34 static ClangTidyModuleRegistry::Add<altera::AlteraModule>
35     X("altera-module", "Adds Altera FPGA OpenCL lint checks.");
36 
37 // This anchor is used to force the linker to link in the generated object file
38 // and thus register the AlteraModule.
39 volatile int AlteraModuleAnchorSource = 0;
40 
41 } // namespace tidy
42 } // namespace clang
43