MiscTidyModule.cpp 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 "ConfusableIdentifierCheck.h"
  12. #include "ConstCorrectnessCheck.h"
  13. #include "DefinitionsInHeadersCheck.h"
  14. #include "MisleadingBidirectional.h"
  15. #include "MisleadingIdentifier.h"
  16. #include "MisplacedConstCheck.h"
  17. #include "NewDeleteOverloadsCheck.h"
  18. #include "NoRecursionCheck.h"
  19. #include "NonCopyableObjects.h"
  20. #include "NonPrivateMemberVariablesInClassesCheck.h"
  21. #include "RedundantExpressionCheck.h"
  22. #include "StaticAssertCheck.h"
  23. #include "ThrowByValueCatchByReferenceCheck.h"
  24. #include "UnconventionalAssignOperatorCheck.h"
  25. #include "UniqueptrResetReleaseCheck.h"
  26. #include "UnusedAliasDeclsCheck.h"
  27. #include "UnusedParametersCheck.h"
  28. #include "UnusedUsingDeclsCheck.h"
  29. #include "UseAnonymousNamespaceCheck.h"
  30. namespace clang::tidy {
  31. namespace misc {
  32. class MiscModule : public ClangTidyModule {
  33. public:
  34. void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
  35. CheckFactories.registerCheck<ConfusableIdentifierCheck>(
  36. "misc-confusable-identifiers");
  37. CheckFactories.registerCheck<ConstCorrectnessCheck>(
  38. "misc-const-correctness");
  39. CheckFactories.registerCheck<DefinitionsInHeadersCheck>(
  40. "misc-definitions-in-headers");
  41. CheckFactories.registerCheck<MisleadingBidirectionalCheck>(
  42. "misc-misleading-bidirectional");
  43. CheckFactories.registerCheck<MisleadingIdentifierCheck>(
  44. "misc-misleading-identifier");
  45. CheckFactories.registerCheck<MisplacedConstCheck>("misc-misplaced-const");
  46. CheckFactories.registerCheck<NewDeleteOverloadsCheck>(
  47. "misc-new-delete-overloads");
  48. CheckFactories.registerCheck<NoRecursionCheck>("misc-no-recursion");
  49. CheckFactories.registerCheck<NonCopyableObjectsCheck>(
  50. "misc-non-copyable-objects");
  51. CheckFactories.registerCheck<NonPrivateMemberVariablesInClassesCheck>(
  52. "misc-non-private-member-variables-in-classes");
  53. CheckFactories.registerCheck<RedundantExpressionCheck>(
  54. "misc-redundant-expression");
  55. CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
  56. CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>(
  57. "misc-throw-by-value-catch-by-reference");
  58. CheckFactories.registerCheck<UnconventionalAssignOperatorCheck>(
  59. "misc-unconventional-assign-operator");
  60. CheckFactories.registerCheck<UniqueptrResetReleaseCheck>(
  61. "misc-uniqueptr-reset-release");
  62. CheckFactories.registerCheck<UnusedAliasDeclsCheck>(
  63. "misc-unused-alias-decls");
  64. CheckFactories.registerCheck<UnusedParametersCheck>(
  65. "misc-unused-parameters");
  66. CheckFactories.registerCheck<UnusedUsingDeclsCheck>(
  67. "misc-unused-using-decls");
  68. CheckFactories.registerCheck<UseAnonymousNamespaceCheck>(
  69. "misc-use-anonymous-namespace");
  70. }
  71. };
  72. } // namespace misc
  73. // Register the MiscTidyModule using this statically initialized variable.
  74. static ClangTidyModuleRegistry::Add<misc::MiscModule>
  75. X("misc-module", "Adds miscellaneous lint checks.");
  76. // This anchor is used to force the linker to link in the generated object file
  77. // and thus register the MiscModule.
  78. volatile int MiscModuleAnchorSource = 0;
  79. } // namespace clang::tidy