FuchsiaTidyModule.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //===--- FuchsiaTidyModule.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 "../google/UnnamedNamespaceInHeaderCheck.h"
  12. #include "DefaultArgumentsCallsCheck.h"
  13. #include "DefaultArgumentsDeclarationsCheck.h"
  14. #include "MultipleInheritanceCheck.h"
  15. #include "OverloadedOperatorCheck.h"
  16. #include "StaticallyConstructedObjectsCheck.h"
  17. #include "TrailingReturnCheck.h"
  18. #include "VirtualInheritanceCheck.h"
  19. using namespace clang::ast_matchers;
  20. namespace clang::tidy {
  21. namespace fuchsia {
  22. /// This module is for Fuchsia-specific checks.
  23. class FuchsiaModule : public ClangTidyModule {
  24. public:
  25. void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
  26. CheckFactories.registerCheck<DefaultArgumentsCallsCheck>(
  27. "fuchsia-default-arguments-calls");
  28. CheckFactories.registerCheck<DefaultArgumentsDeclarationsCheck>(
  29. "fuchsia-default-arguments-declarations");
  30. CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
  31. "fuchsia-header-anon-namespaces");
  32. CheckFactories.registerCheck<MultipleInheritanceCheck>(
  33. "fuchsia-multiple-inheritance");
  34. CheckFactories.registerCheck<OverloadedOperatorCheck>(
  35. "fuchsia-overloaded-operator");
  36. CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>(
  37. "fuchsia-statically-constructed-objects");
  38. CheckFactories.registerCheck<TrailingReturnCheck>(
  39. "fuchsia-trailing-return");
  40. CheckFactories.registerCheck<VirtualInheritanceCheck>(
  41. "fuchsia-virtual-inheritance");
  42. }
  43. };
  44. // Register the FuchsiaTidyModule using this statically initialized variable.
  45. static ClangTidyModuleRegistry::Add<FuchsiaModule>
  46. X("fuchsia-module", "Adds Fuchsia platform checks.");
  47. } // namespace fuchsia
  48. // This anchor is used to force the linker to link in the generated object file
  49. // and thus register the FuchsiaModule.
  50. volatile int FuchsiaModuleAnchorSource = 0;
  51. } // namespace clang::tidy