clang-tools  14.0.0git
AlteraTidyModule.cpp
Go to the documentation of this file.
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"
15 #include "StructPackAlignCheck.h"
16 #include "UnrollLoopsCheck.h"
17 
18 using namespace clang::ast_matchers;
19 
20 namespace clang {
21 namespace tidy {
22 namespace altera {
23 
24 class AlteraModule : public ClangTidyModule {
25 public:
26  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
28  "altera-id-dependent-backward-branch");
30  "altera-kernel-name-restriction");
32  "altera-single-work-item-barrier");
33  CheckFactories.registerCheck<StructPackAlignCheck>(
34  "altera-struct-pack-align");
35  CheckFactories.registerCheck<UnrollLoopsCheck>("altera-unroll-loops");
36  }
37 };
38 
39 } // namespace altera
40 
41 // Register the AlteraTidyModule using this statically initialized variable.
42 static 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.
47 volatile int AlteraModuleAnchorSource = 0;
48 
49 } // namespace tidy
50 } // namespace clang
clang::tidy::altera::KernelNameRestrictionCheck
Finds kernel files and include directives whose filename is kernel.cl, Verilog.cl,...
Definition: KernelNameRestrictionCheck.h:23
clang::tidy::altera::AlteraModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module.
Definition: AlteraTidyModule.cpp:26
clang::ast_matchers
Definition: AbseilMatcher.h:14
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:28
clang::tidy::altera::StructPackAlignCheck
Finds structs that are inefficiently packed or aligned, and recommends packing and/or aligning of sai...
Definition: StructPackAlignCheck.h:23
X
int X
Definition: LSPBinderTests.cpp:25
clang::tidy::AlteraModuleAnchorSource
volatile int AlteraModuleAnchorSource
Definition: AlteraTidyModule.cpp:47
clang::tidy::altera::IdDependentBackwardBranchCheck
Finds ID-dependent variables and fields used within loops, and warns of their usage.
Definition: IdDependentBackwardBranchCheck.h:24
StructPackAlignCheck.h
clang::tidy::altera::AlteraModule
Definition: AlteraTidyModule.cpp:24
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
IdDependentBackwardBranchCheck.h
clang::tidy::altera::SingleWorkItemBarrierCheck
Detects OpenCL kernel functions that call a barrier but do not call an ID-function function.
Definition: SingleWorkItemBarrierCheck.h:24
KernelNameRestrictionCheck.h
UnrollLoopsCheck.h
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:81
clang::tidy::altera::UnrollLoopsCheck
Finds inner loops that have not been unrolled, as well as fully unrolled loops with unknown loop boun...
Definition: UnrollLoopsCheck.h:27
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:59
SingleWorkItemBarrierCheck.h