37 lines · c
1//===----------------------------------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DUPLICATEINCLUDECHECK_H10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DUPLICATEINCLUDECHECK_H11 12#include "../ClangTidyCheck.h"13 14namespace clang::tidy::readability {15 16/// \brief Find and remove duplicate #include directives.17///18/// Only consecutive include directives without any other preprocessor19/// directives between them are analyzed.20class DuplicateIncludeCheck : public ClangTidyCheck {21public:22 DuplicateIncludeCheck(StringRef Name, ClangTidyContext *Context);23 24 void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,25 Preprocessor *ModuleExpanderPP) override;26 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;27 28private:29 // Semicolon-separated list of regexes or file names to ignore from duplicate30 // warnings.31 const std::vector<StringRef> IgnoredFilesList;32};33 34} // namespace clang::tidy::readability35 36#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_DUPLICATEINCLUDECHECK_H37