9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDEINSERTER_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDEINSERTER_H
13#include "clang/Basic/Diagnostic.h"
14#include "llvm/ADT/StringSet.h"
55class IncludeInserter {
62 explicit IncludeInserter(IncludeSorter::IncludeStyle Style,
63 bool SelfContainedDiags);
67 void registerPreprocessor(Preprocessor *PP);
75 llvm::StringRef Header);
82 std::optional<FixItHint>
85 IncludeSorter::IncludeStyle
getStyle()
const {
return Style; }
88 void addInclude(StringRef FileName,
bool IsAngled,
89 SourceLocation HashLocation, SourceLocation EndLocation);
91 IncludeSorter &getOrCreate(FileID FileID);
93 llvm::DenseMap<FileID, std::unique_ptr<IncludeSorter>> IncludeSorterByFile;
94 llvm::DenseMap<FileID, llvm::StringSet<>> InsertedHeaders;
95 const SourceManager *SourceMgr{
nullptr};
96 const IncludeSorter::IncludeStyle Style;
97 const bool SelfContainedDiags;
IncludeSorter::IncludeStyle getStyle() const
std::optional< FixItHint > createMainFileIncludeInsertion(llvm::StringRef Header)
Produces fixes to insert specified includes to source files, if not yet present.
std::optional< FixItHint > createIncludeInsertion(StringRef FileName, bool IsAngled)
Creates a quoted inclusion directive in the right sort order.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//