clang-tools
15.0.0git
|
Produces fixes to insert specified includes to source files, if not yet present. More...
#include <IncludeInserter.h>
Public Member Functions | |
IncludeInserter (IncludeSorter::IncludeStyle Style, bool SelfContainedDiags) | |
Initializes the IncludeInserter using the IncludeStyle Style . More... | |
void | registerPreprocessor (Preprocessor *PP) |
Registers this with the Preprocessor PP , must be called before this class is used. More... | |
llvm::Optional< FixItHint > | createIncludeInsertion (FileID FileID, llvm::StringRef Header) |
Creates a Header inclusion directive fixit in the File FileID . More... | |
llvm::Optional< FixItHint > | createMainFileIncludeInsertion (llvm::StringRef Header) |
Creates a Header inclusion directive fixit in the main file. More... | |
IncludeSorter::IncludeStyle | getStyle () const |
Friends | |
class | IncludeInserterCallback |
Produces fixes to insert specified includes to source files, if not yet present.
IncludeInserter
can be used in clang-tidy checks in the following way:
Definition at line 55 of file IncludeInserter.h.
|
explicit |
Initializes the IncludeInserter using the IncludeStyle Style
.
In most cases the Style
will be retrieved from the ClangTidyOptions using
Definition at line 39 of file IncludeInserter.cpp.
llvm::Optional< FixItHint > clang::tidy::utils::IncludeInserter::createIncludeInsertion | ( | FileID | FileID, |
llvm::StringRef | Header | ||
) |
Creates a Header
inclusion directive fixit in the File FileID
.
When Header
is enclosed in angle brackets, uses angle brackets in the inclusion directive, otherwise uses quotes. Returns llvm::None
on error or if the inclusion directive already exists.
Definition at line 71 of file IncludeInserter.cpp.
References clang::tidy::utils::IncludeSorter::createIncludeInsertion(), and IsAngled.
Referenced by createMainFileIncludeInsertion().
llvm::Optional< FixItHint > clang::tidy::utils::IncludeInserter::createMainFileIncludeInsertion | ( | llvm::StringRef | Header | ) |
Creates a Header
inclusion directive fixit in the main file.
When Header
is enclosed in angle brackets, uses angle brackets in the inclusion directive, otherwise uses quotes. Returns llvm::None
on error or if the inclusion directive already exists.
Definition at line 86 of file IncludeInserter.cpp.
References createIncludeInsertion().
|
inline |
Definition at line 85 of file IncludeInserter.h.
void clang::tidy::utils::IncludeInserter::registerPreprocessor | ( | Preprocessor * | PP | ) |
Registers this with the Preprocessor PP
, must be called before this class is used.
Definition at line 43 of file IncludeInserter.cpp.
References clang::tidy::bugprone::PP.
|
friend |
Definition at line 98 of file IncludeInserter.h.