summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/CodeComplete.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.h')
-rw-r--r--clang-tools-extra/clangd/CodeComplete.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.h b/clang-tools-extra/clangd/CodeComplete.h
index 1785fb6a68e..3213acc7a31 100644
--- a/clang-tools-extra/clangd/CodeComplete.h
+++ b/clang-tools-extra/clangd/CodeComplete.h
@@ -26,6 +26,7 @@
#include "clang/Sema/CodeCompleteOptions.h"
#include "clang/Tooling/CompilationDatabase.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include <future>
@@ -131,12 +132,20 @@ struct CodeCompletion {
// Other fields should apply equally to all bundled completions.
unsigned BundleSize = 1;
SymbolOrigin Origin = SymbolOrigin::Unknown;
- // The header through which this symbol could be included.
- // Quoted string as expected by an #include directive, e.g. "<memory>".
- // Empty for non-symbol completions, or when not known.
- std::string Header;
- // Present if Header is set and should be inserted to use this item.
- llvm::Optional<TextEdit> HeaderInsertion;
+
+ struct IncludeCandidate {
+ // The header through which this symbol could be included.
+ // Quoted string as expected by an #include directive, e.g. "<memory>".
+ // Empty for non-symbol completions, or when not known.
+ std::string Header;
+ // Present if Header should be inserted to use this item.
+ llvm::Optional<TextEdit> Insertion;
+ };
+ // All possible include headers ranked by preference. By default, the first
+ // include is used.
+ // If we've bundled together overloads that have different sets of includes,
+ // thse includes may not be accurate for all of them.
+ llvm::SmallVector<IncludeCandidate, 1> Includes;
/// Holds information about small corrections that needs to be done. Like
/// converting '->' to '.' on member access.
OpenPOWER on IntegriCloud