clang-tools
20.0.0git
llvm-project
clang-tools-extra
clang-tidy
bugprone
SuspiciousIncludeCheck.h
Go to the documentation of this file.
1
//===--- SuspiciousIncludeCheck.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
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
#include "../utils/FileExtensionsUtils.h"
14
15
namespace
clang::tidy::bugprone
{
16
17
/// Warns on inclusion of files whose names suggest that they're implementation
18
/// files, instead of headers. E.g:
19
///
20
/// #include "foo.cpp" // warning
21
/// #include "bar.c" // warning
22
/// #include "baz.h" // no diagnostic
23
///
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
{
27
public
:
28
SuspiciousIncludeCheck
(StringRef
Name
,
ClangTidyContext
*Context);
29
void
registerPPCallbacks
(
const
SourceManager &SM, Preprocessor *
PP
,
30
Preprocessor *ModuleExpanderPP)
override
;
31
32
FileExtensionsSet
HeaderFileExtensions
;
33
FileExtensionsSet
ImplementationFileExtensions
;
34
};
35
36
}
// namespace clang::tidy::bugprone
37
38
#endif
// LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SUSPICIOUSINCLUDECHECK_H
Name
llvm::SmallString< 256U > Name
Definition:
ChainedComparisonCheck.cpp:42
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition:
ClangTidyCheck.h:53
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:69
clang::tidy::bugprone::SuspiciousIncludeCheck
Warns on inclusion of files whose names suggest that they're implementation files,...
Definition:
SuspiciousIncludeCheck.h:26
clang::tidy::bugprone::SuspiciousIncludeCheck::registerPPCallbacks
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override
Override this to register PPCallbacks in the preprocessor.
Definition:
SuspiciousIncludeCheck.cpp:46
clang::tidy::bugprone::SuspiciousIncludeCheck::ImplementationFileExtensions
FileExtensionsSet ImplementationFileExtensions
Definition:
SuspiciousIncludeCheck.h:33
clang::tidy::bugprone::SuspiciousIncludeCheck::HeaderFileExtensions
FileExtensionsSet HeaderFileExtensions
Definition:
SuspiciousIncludeCheck.h:32
clang::tidy::bugprone
Definition:
ArgumentCommentCheck.cpp:19
clang::tidy::bugprone::PP
static Preprocessor * PP
Definition:
BadSignalToKillThreadCheck.cpp:28
clang::tidy::FileExtensionsSet
llvm::SmallSet< llvm::StringRef, 5 > FileExtensionsSet
Definition:
FileExtensionsSet.h:16
Generated on Sat Dec 7 2024 15:50:18 for clang-tools by
1.9.6