clang-tools 22.0.0git
AlteraTidyModule.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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"
15#include "UnrollLoopsCheck.h"
16
17using namespace clang::ast_matchers;
18
19namespace clang::tidy {
20namespace altera {
21namespace {
22
23class AlteraModule : public ClangTidyModule {
24public:
25 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
27 "altera-id-dependent-backward-branch");
29 "altera-kernel-name-restriction");
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
39} // namespace altera
40
41// Register the AlteraTidyModule using this statically initialized variable.
42static ClangTidyModuleRegistry::Add<altera::AlteraModule>
43 X("altera-module", "Adds Altera FPGA OpenCL lint checks.");
44
45// This anchor is used to force the linker to link in the generated object file
46// and thus register the AlteraModule.
47volatile int AlteraModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
48
49} // namespace clang::tidy
A collection of ClangTidyCheckFactory instances.
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Finds ID-dependent variables and fields used within loops, and warns of their usage.
Finds kernel files and include directives whose filename is kernel.cl, Verilog.cl,...
Detects OpenCL kernel functions that call a barrier but do not call an ID-function function.
Finds structs that are inefficiently packed or aligned, and recommends packing and/or aligning of sai...
Finds inner loops that have not been unrolled, as well as fully unrolled loops with unknown loop boun...
volatile int AlteraModuleAnchorSource
static ClangTidyModuleRegistry::Add< altera::AlteraModule > X("altera-module", "Adds Altera FPGA OpenCL lint checks.")