blob: d3e906b673ce737b5f0a754dcc1167e0764efd21 [file] [log] [blame]
Frank Derry Wanye156b1272020-09-08 09:35:14 -04001//===--- 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 Wanye9ca6fc42020-11-09 09:20:35 -050012#include "KernelNameRestrictionCheck.h"
Frank Derry Wanye156b1272020-09-08 09:35:14 -040013#include "StructPackAlignCheck.h"
14
15using namespace clang::ast_matchers;
16
17namespace clang {
18namespace tidy {
19namespace altera {
20
21class AlteraModule : public ClangTidyModule {
22public:
23 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Frank Derry Wanye9ca6fc42020-11-09 09:20:35 -050024 CheckFactories.registerCheck<KernelNameRestrictionCheck>(
25 "altera-kernel-name-restriction");
Frank Derry Wanye156b1272020-09-08 09:35:14 -040026 CheckFactories.registerCheck<StructPackAlignCheck>(
27 "altera-struct-pack-align");
28 }
29};
30
31} // namespace altera
32
33// Register the AlteraTidyModule using this statically initialized variable.
34static 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.
39volatile int AlteraModuleAnchorSource = 0;
40
41} // namespace tidy
42} // namespace clang