41 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_BUGPRONE_SUSPICIOUSINCLUDECHECK_H10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H11 12#include "../ClangTidyCheck.h"13 14namespace clang::tidy::bugprone {15 16/// Warns on inclusion of files whose names suggest that they're implementation17/// files, instead of headers. E.g:18///19/// #include "foo.cpp" // warning20/// #include "bar.c" // warning21/// #include "baz.h" // no diagnostic22///23/// For the user-facing documentation see:24/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/suspicious-include.html25class SuspiciousIncludeCheck : public ClangTidyCheck {26public:27 SuspiciousIncludeCheck(StringRef Name, ClangTidyContext *Context);28 void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,29 Preprocessor *ModuleExpanderPP) override;30 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;31 32 FileExtensionsSet HeaderFileExtensions;33 FileExtensionsSet ImplementationFileExtensions;34 StringRef IgnoredRegexString;35 llvm::Regex IgnoredRegex;36};37 38} // namespace clang::tidy::bugprone39 40#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H41