Module.cxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include <clang-tidy/ClangTidyModule.h>
  4. #include <clang-tidy/ClangTidyModuleRegistry.h>
  5. #include "OstringstreamUseCmstrcatCheck.h"
  6. #include "StringConcatenationUseCmstrcatCheck.h"
  7. #include "UseBespokeEnumClassCheck.h"
  8. #include "UseCmstrlenCheck.h"
  9. #include "UseCmsysFstreamCheck.h"
  10. #include "UsePragmaOnceCheck.h"
  11. namespace clang {
  12. namespace tidy {
  13. namespace cmake {
  14. class CMakeClangTidyModule : public ClangTidyModule
  15. {
  16. public:
  17. void addCheckFactories(ClangTidyCheckFactories& CheckFactories) override
  18. {
  19. CheckFactories.registerCheck<UseCmstrlenCheck>("cmake-use-cmstrlen");
  20. CheckFactories.registerCheck<UseCmsysFstreamCheck>(
  21. "cmake-use-cmsys-fstream");
  22. CheckFactories.registerCheck<UseBespokeEnumClassCheck>(
  23. "cmake-use-bespoke-enum-class");
  24. CheckFactories.registerCheck<OstringstreamUseCmstrcatCheck>(
  25. "cmake-ostringstream-use-cmstrcat");
  26. CheckFactories.registerCheck<UsePragmaOnceCheck>("cmake-use-pragma-once");
  27. CheckFactories.registerCheck<StringConcatenationUseCmstrcatCheck>(
  28. "cmake-string-concatenation-use-cmstrcat");
  29. }
  30. };
  31. static ClangTidyModuleRegistry::Add<CMakeClangTidyModule> X(
  32. "cmake-clang-tidy", "Adds lint checks for the CMake code base.");
  33. }
  34. }
  35. }