DarwinTidyModule.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //===--- MiscTidyModule.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 "AvoidSpinlockCheck.h"
  12. #include "DispatchOnceNonstaticCheck.h"
  13. namespace clang::tidy {
  14. namespace darwin {
  15. class DarwinModule : public ClangTidyModule {
  16. public:
  17. void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
  18. CheckFactories.registerCheck<AvoidSpinlockCheck>(
  19. "darwin-avoid-spinlock");
  20. CheckFactories.registerCheck<DispatchOnceNonstaticCheck>(
  21. "darwin-dispatch-once-nonstatic");
  22. }
  23. };
  24. } // namespace darwin
  25. // Register the DarwinTidyModule using this statically initialized variable.
  26. static ClangTidyModuleRegistry::Add<darwin::DarwinModule>
  27. X("darwin-module", "Adds Darwin-specific lint checks.");
  28. // This anchor is used to force the linker to link in the generated object file
  29. // and thus register the DarwinModule.
  30. volatile int DarwinModuleAnchorSource = 0;
  31. } // namespace clang::tidy