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,
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;
65 class UnresolvedNameRecorder;
71 std::vector<Fix> fixUnresolvedName()
const;
74 std::shared_ptr<IncludeInserter> Inserter;
75 const SymbolIndex &
Index;
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 *>
91 fuzzyFindCached(
const FuzzyFindRequest &Req)
const;
92 llvm::Optional<const SymbolSlab *> lookupCached(
const SymbolID &ID)
const;
98 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INCLUDE_FIXER_H