9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INCLUDE_FIXER_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INCLUDE_FIXER_H 16 #include "clang/AST/Type.h" 17 #include "clang/Basic/Diagnostic.h" 18 #include "clang/Basic/SourceLocation.h" 19 #include "clang/Sema/ExternalSemaSource.h" 20 #include "clang/Sema/Sema.h" 21 #include "llvm/ADT/ArrayRef.h" 22 #include "llvm/ADT/DenseMap.h" 23 #include "llvm/ADT/IntrusiveRefCntPtr.h" 24 #include "llvm/ADT/Optional.h" 25 #include "llvm/ADT/StringMap.h" 26 #include "llvm/ADT/StringRef.h" 37 IncludeFixer(llvm::StringRef File, std::shared_ptr<IncludeInserter> Inserter,
38 const SymbolIndex &Index,
unsigned IndexRequestLimit)
39 : File(File), Inserter(std::move(Inserter)), Index(Index),
40 IndexRequestLimit(IndexRequestLimit) {}
43 std::vector<Fix>
fix(DiagnosticsEngine::Level DiagLevel,
44 const clang::Diagnostic &
Info)
const;
53 std::vector<Fix> fixIncompleteType(
const Type &T)
const;
56 std::vector<Fix> fixesForSymbols(
const SymbolSlab &Syms)
const;
58 struct UnresolvedName {
61 std::vector<std::string> Scopes;
71 std::vector<Fix> fixUnresolvedName()
const;
74 std::shared_ptr<IncludeInserter> Inserter;
76 const unsigned IndexRequestLimit;
77 mutable unsigned IndexRequestCount = 0;
81 llvm::Optional<UnresolvedName> LastUnresolvedName;
87 mutable llvm::StringMap<SymbolSlab> FuzzyFindCache;
88 mutable llvm::DenseMap<SymbolID, SymbolSlab> LookupCache;
90 llvm::Optional<const SymbolSlab *>
92 llvm::Optional<const SymbolSlab *> lookupCached(
const SymbolID &ID)
const;
98 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INCLUDE_FIXER_H SourceLocation Loc
'#' location in the include directive
An immutable symbol container that stores a set of symbols.
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
Attempts to recover from error diagnostics by suggesting include insertion fixes. ...
IncludeFixer(llvm::StringRef File, std::shared_ptr< IncludeInserter > Inserter, const SymbolIndex &Index, unsigned IndexRequestLimit)
static constexpr llvm::StringLiteral Name
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::IntrusiveRefCntPtr< ExternalSemaSource > unresolvedNameRecorder()
Returns an ExternalSemaSource that records failed name lookups in Sema.
std::vector< Fix > fix(DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &Info) const
Returns include insertions that can potentially recover the diagnostic.
const SymbolIndex * Index