clang-tools 22.0.0git
SuspiciousIncludeCheck.h
Go to the documentation of this file.
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-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H
11
12#include "../ClangTidyCheck.h"
13
14namespace clang::tidy::bugprone {
15
16/// Warns on inclusion of files whose names suggest that they're implementation
17/// files, instead of headers. E.g:
18///
19/// #include "foo.cpp" // warning
20/// #include "bar.c" // warning
21/// #include "baz.h" // no diagnostic
22///
23/// For the user-facing documentation see:
24/// https://clang.llvm.org/extra/clang-tidy/checks/bugprone/suspicious-include.html
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
35 llvm::Regex IgnoredRegex;
36};
37
38} // namespace clang::tidy::bugprone
39
40#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override
SuspiciousIncludeCheck(StringRef Name, ClangTidyContext *Context)
llvm::SmallSet< llvm::StringRef, 5 > FileExtensionsSet
llvm::StringMap< ClangTidyValue > OptionMap