9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H
12#include "../ClangTidyCheck.h"
40 IncludeSorter(
const SourceManager *SourceMgr,
const FileID FileID,
45 SourceLocation HashLocation, SourceLocation EndLocation);
54 using SourceRangeVector = SmallVector<SourceRange, 1>;
56 const SourceManager *SourceMgr;
60 StringRef CanonicalFile;
62 SourceRangeVector SourceLocations;
64 llvm::StringMap<SourceRangeVector> IncludeLocations;
72 static ArrayRef<std::pair<utils::IncludeSorter::IncludeStyle, StringRef>>
bool IsAngled
true if this was an include with angle brackets
Class used by IncludeInserterCallback to record the names of the inclusions in a given source file be...
IncludeKinds
The classifications of inclusions, in the order they should be sorted.
@ IK_CSystemInclude
e.g. #include <stdio.h>
@ IK_NonSystemInclude
e.g. #include "bar.h"
@ IK_InvalidInclude
total number of valid IncludeKinds
@ IK_MainTUInclude
e.g. #include "foo.h" when editing foo.cc
@ IK_GeneratedInclude
e.g. #include "bar.proto.h"
@ IK_CXXSystemInclude
e.g. #include <vector>
void addInclude(StringRef FileName, bool IsAngled, SourceLocation HashLocation, SourceLocation EndLocation)
Adds the given include directive to the sorter.
IncludeStyle
Supported include styles.
std::optional< FixItHint > createIncludeInsertion(StringRef FileName, bool IsAngled)
Creates a quoted inclusion directive in the right sort order.
This class should be specialized by any enum type that needs to be converted to and from an llvm::Str...
static ArrayRef< std::pair< T, StringRef > > getEnumMapping()=delete