10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H
13 #include "../ClangTidy.h"
46 IncludeSorter(
const SourceManager *SourceMgr,
const LangOptions *LangOpts,
47 const FileID FileID, StringRef FileName,
IncludeStyle Style);
55 SourceLocation HashLocation, SourceLocation EndLocation);
67 typedef SmallVector<SourceRange, 1> SourceRangeVector;
69 const SourceManager *SourceMgr;
70 const LangOptions *LangOpts;
74 StringRef CanonicalFile;
76 SourceRangeVector SourceLocations;
78 llvm::StringMap<SourceRangeVector> IncludeLocations;
86 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H
e.g. #include "foo.h" when editing foo.cc
const FileID current_FileID() const
Returns the SourceManager-specific file ID for the file being handled by the sorter.
static StringRef toString(IncludeStyle Style)
Converts IncludeStyle to string representation.
IncludeStyle
Supported include styles.
IncludeKinds
The classifications of inclusions, in the order they should be sorted.
IncludeSorter(const SourceManager *SourceMgr, const LangOptions *LangOpts, const FileID FileID, StringRef FileName, IncludeStyle Style)
IncludeSorter constructor; takes the FileID and name of the file to be processed by the sorter...
bool IsAngled
true if this was an include with angle brackets
void AddInclude(StringRef FileName, bool IsAngled, SourceLocation HashLocation, SourceLocation EndLocation)
Adds the given include directive to the sorter.
total number of valid IncludeKinds
static IncludeStyle parseIncludeStyle(const std::string &Value)
Converts "llvm" to IS_LLVM, otherwise returns IS_Google.
Optional< FixItHint > CreateIncludeInsertion(StringRef FileName, bool IsAngled)
Creates a quoted inclusion directive in the right sort order.
Class used by IncludeInserterCallback to record the names of the inclusions in a given source file be...
std::vector< FixItHint > GetEdits()
Returns the edits needed to sort the current set of includes and reset the internal state (so that di...