AlteraTidyModule.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. #include "../ClangTidy.h"
  9. #include "../ClangTidyModule.h"
  10. #include "../ClangTidyModuleRegistry.h"
  11. #include "IdDependentBackwardBranchCheck.h"
  12. #include "KernelNameRestrictionCheck.h"
  13. #include "SingleWorkItemBarrierCheck.h"
  14. #include "StructPackAlignCheck.h"
  15. #include "UnrollLoopsCheck.h"
  16. using namespace clang::ast_matchers;
  17. namespace clang::tidy {
  18. namespace altera {
  19. class AlteraModule : public ClangTidyModule {
  20. public:
  21. void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
  22. CheckFactories.registerCheck<IdDependentBackwardBranchCheck>(
  23. "altera-id-dependent-backward-branch");
  24. CheckFactories.registerCheck<KernelNameRestrictionCheck>(
  25. "altera-kernel-name-restriction");
  26. CheckFactories.registerCheck<SingleWorkItemBarrierCheck>(
  27. "altera-single-work-item-barrier");
  28. CheckFactories.registerCheck<StructPackAlignCheck>(
  29. "altera-struct-pack-align");
  30. CheckFactories.registerCheck<UnrollLoopsCheck>("altera-unroll-loops");
  31. }
  32. };
  33. } // namespace altera
  34. // Register the AlteraTidyModule using this statically initialized variable.
  35. static ClangTidyModuleRegistry::Add<altera::AlteraModule>
  36. X("altera-module", "Adds Altera FPGA OpenCL lint checks.");
  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. } // namespace clang::tidy