clang-tools
11.0.0
|
Class used by IncludeInserterCallback
to record the names of the inclusions in a given source file being processed and generate the necessary commands to sort the inclusions according to the precedence encoded in IncludeKinds
.
More...
#include <IncludeSorter.h>
Public Types | |
enum | IncludeStyle { IS_LLVM = 0, IS_Google = 1 } |
Supported include styles. More... | |
enum | IncludeKinds { IK_MainTUInclude = 0, IK_CSystemInclude = 1, IK_CXXSystemInclude = 2, IK_NonSystemInclude = 3, IK_InvalidInclude = 4 } |
The classifications of inclusions, in the order they should be sorted. More... | |
Public Member Functions | |
IncludeSorter (const SourceManager *SourceMgr, const FileID FileID, StringRef FileName, IncludeStyle Style) | |
IncludeSorter constructor; takes the FileID and name of the file to be processed by the sorter. More... | |
void | AddInclude (StringRef FileName, bool IsAngled, SourceLocation HashLocation, SourceLocation EndLocation) |
Adds the given include directive to the sorter. More... | |
Optional< FixItHint > | CreateIncludeInsertion (StringRef FileName, bool IsAngled) |
Creates a quoted inclusion directive in the right sort order. More... | |
Class used by IncludeInserterCallback
to record the names of the inclusions in a given source file being processed and generate the necessary commands to sort the inclusions according to the precedence encoded in IncludeKinds
.
Definition at line 23 of file IncludeSorter.h.
The classifications of inclusions, in the order they should be sorted.
Definition at line 29 of file IncludeSorter.h.
Supported include styles.
Enumerator | |
---|---|
IS_LLVM | |
IS_Google |
Definition at line 26 of file IncludeSorter.h.
clang::tidy::utils::IncludeSorter::IncludeSorter | ( | const SourceManager * | SourceMgr, |
const FileID | FileID, | ||
StringRef | FileName, | ||
IncludeStyle | Style | ||
) |
IncludeSorter
constructor; takes the FileID and name of the file to be processed by the sorter.
Definition at line 86 of file IncludeSorter.cpp.
void clang::tidy::utils::IncludeSorter::AddInclude | ( | StringRef | FileName, |
bool | IsAngled, | ||
SourceLocation | HashLocation, | ||
SourceLocation | EndLocation | ||
) |
Adds the given include directive to the sorter.
Definition at line 92 of file IncludeSorter.cpp.
References FileName, IK_InvalidInclude, IsAngled, Kind, and Offset.
Optional< FixItHint > clang::tidy::utils::IncludeSorter::CreateIncludeInsertion | ( | StringRef | FileName, |
bool | IsAngled | ||
) |
Creates a quoted inclusion directive in the right sort order.
Returns None on error or if header inclusion directive for header already exists.
Definition at line 113 of file IncludeSorter.cpp.
References FileName, IK_InvalidInclude, and IsAngled.
Referenced by clang::tidy::utils::IncludeInserter::CreateIncludeInsertion().