Frank Derry Wanye | 156b127 | 2020-09-08 09:35:14 -0400 | [diff] [blame] | 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" |
Frank Derry Wanye | 9ca6fc4 | 2020-11-09 09:20:35 -0500 | [diff] [blame] | 12 | #include "KernelNameRestrictionCheck.h" |
Frank Derry Wanye | 156b127 | 2020-09-08 09:35:14 -0400 | [diff] [blame] | 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: |
| 23 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
Frank Derry Wanye | 9ca6fc4 | 2020-11-09 09:20:35 -0500 | [diff] [blame] | 24 | CheckFactories.registerCheck<KernelNameRestrictionCheck>( |
| 25 | "altera-kernel-name-restriction"); |
Frank Derry Wanye | 156b127 | 2020-09-08 09:35:14 -0400 | [diff] [blame] | 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 |