1 //===--- SuspiciousIncludeCheck.h - clang-tidy ------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H
12 #include "../ClangTidyCheck.h"
13 #include "../utils/FileExtensionsUtils.h"
15 namespace clang::tidy::bugprone
{
17 /// Warns on inclusion of files whose names suggest that they're implementation
18 /// files, instead of headers. E.g:
20 /// #include "foo.cpp" // warning
21 /// #include "bar.c" // warning
22 /// #include "baz.h" // no diagnostic
24 /// For the user-facing documentation see:
25 /// http://clang.llvm.org/extra/clang-tidy/checks/bugprone/suspicious-include.html
26 class SuspiciousIncludeCheck
: public ClangTidyCheck
{
28 SuspiciousIncludeCheck(StringRef Name
, ClangTidyContext
*Context
);
29 void registerPPCallbacks(const SourceManager
&SM
, Preprocessor
*PP
,
30 Preprocessor
*ModuleExpanderPP
) override
;
32 FileExtensionsSet HeaderFileExtensions
;
33 FileExtensionsSet ImplementationFileExtensions
;
36 } // namespace clang::tidy::bugprone
38 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H