ZirconTidyModule.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //===--- ZirconTidyModule.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 "TemporaryObjectsCheck.h"
  12. using namespace clang::ast_matchers;
  13. namespace clang::tidy {
  14. namespace zircon {
  15. /// This module is for Zircon-specific checks.
  16. class ZirconModule : public ClangTidyModule {
  17. public:
  18. void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
  19. CheckFactories.registerCheck<TemporaryObjectsCheck>(
  20. "zircon-temporary-objects");
  21. }
  22. };
  23. // Register the ZirconTidyModule using this statically initialized variable.
  24. static ClangTidyModuleRegistry::Add<ZirconModule>
  25. X("zircon-module", "Adds Zircon kernel checks.");
  26. } // namespace zircon
  27. // This anchor is used to force the linker to link in the generated object file
  28. // and thus register the ZirconModule.
  29. volatile int ZirconModuleAnchorSource = 0;
  30. } // namespace clang::tidy