DuplicateIncludeCheck.h 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. //===--- DuplicateIncludeCheck.h - clang-tidy -------------------*- C++ -*-===//
  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. #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DUPLICATE_INCLUDE_CHECK_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DUPLICATE_INCLUDE_CHECK_H
  10. #include "../ClangTidyCheck.h"
  11. namespace clang::tidy::readability {
  12. /// \brief Find and remove duplicate #include directives.
  13. ///
  14. /// Only consecutive include directives without any other preprocessor
  15. /// directives between them are analyzed.
  16. class DuplicateIncludeCheck : public ClangTidyCheck {
  17. public:
  18. DuplicateIncludeCheck(StringRef Name, ClangTidyContext *Context)
  19. : ClangTidyCheck(Name, Context) {}
  20. void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
  21. Preprocessor *ModuleExpanderPP) override;
  22. };
  23. } // namespace clang::tidy::readability
  24. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DUPLICATE_INCLUDE_CHECK_H