ConcurrencyTidyModule.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //===--- ConcurrencyTidyModule.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 "MtUnsafeCheck.h"
  12. #include "ThreadCanceltypeAsynchronousCheck.h"
  13. namespace clang::tidy {
  14. namespace concurrency {
  15. class ConcurrencyModule : public ClangTidyModule {
  16. public:
  17. void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
  18. CheckFactories.registerCheck<concurrency::MtUnsafeCheck>(
  19. "concurrency-mt-unsafe");
  20. CheckFactories.registerCheck<ThreadCanceltypeAsynchronousCheck>(
  21. "concurrency-thread-canceltype-asynchronous");
  22. }
  23. };
  24. } // namespace concurrency
  25. // Register the ConcurrencyTidyModule using this statically initialized variable.
  26. static ClangTidyModuleRegistry::Add<concurrency::ConcurrencyModule>
  27. X("concurrency-module", "Adds concurrency checks.");
  28. // This anchor is used to force the linker to link in the generated object file
  29. // and thus register the ConcurrencyModule.
  30. volatile int ConcurrencyModuleAnchorSource = 0;
  31. } // namespace clang::tidy