No more NonElidedVector

This commit is contained in:
Jacob Dufault 2017-12-11 21:20:29 -08:00
parent e535fab581
commit 12bfabf9c2
21 changed files with 47 additions and 60 deletions

View File

@ -319,7 +319,7 @@ void TryEnsureDocumentParsed(ClangCompleteManager* manager,
return; return;
} }
NonElidedVector<lsDiagnostic> ls_diagnostics; std::vector<lsDiagnostic> ls_diagnostics;
unsigned num_diagnostics = clang_getNumDiagnostics((*tu)->cx_tu); unsigned num_diagnostics = clang_getNumDiagnostics((*tu)->cx_tu);
for (unsigned i = 0; i < num_diagnostics; ++i) { for (unsigned i = 0; i < num_diagnostics; ++i) {
optional<lsDiagnostic> diagnostic = BuildAndDisposeDiagnostic( optional<lsDiagnostic> diagnostic = BuildAndDisposeDiagnostic(
@ -412,7 +412,7 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
{ {
if (request->on_complete) { if (request->on_complete) {
NonElidedVector<lsCompletionItem> ls_result; std::vector<lsCompletionItem> ls_result;
ls_result.reserve(cx_results->NumResults); ls_result.reserve(cx_results->NumResults);
timer.Reset(); timer.Reset();
@ -487,7 +487,7 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
} }
size_t num_diagnostics = clang_getNumDiagnostics(session->tu->cx_tu); size_t num_diagnostics = clang_getNumDiagnostics(session->tu->cx_tu);
NonElidedVector<lsDiagnostic> ls_diagnostics; std::vector<lsDiagnostic> ls_diagnostics;
ls_diagnostics.reserve(num_diagnostics); ls_diagnostics.reserve(num_diagnostics);
for (unsigned i = 0; i < num_diagnostics; ++i) { for (unsigned i = 0; i < num_diagnostics; ++i) {
CXDiagnostic cx_diag = clang_getDiagnostic(session->tu->cx_tu, i); CXDiagnostic cx_diag = clang_getDiagnostic(session->tu->cx_tu, i);

View File

@ -39,13 +39,13 @@ struct CompletionSession
struct ClangCompleteManager { struct ClangCompleteManager {
using OnDiagnostic = using OnDiagnostic =
std::function<void(std::string path, std::function<void(std::string path,
NonElidedVector<lsDiagnostic> diagnostics)>; std::vector<lsDiagnostic> diagnostics)>;
using OnIndex = std::function<void(ClangTranslationUnit* tu, using OnIndex = std::function<void(ClangTranslationUnit* tu,
const std::vector<CXUnsavedFile>& unsaved, const std::vector<CXUnsavedFile>& unsaved,
const std::string& path, const std::string& path,
const std::vector<std::string>& args)>; const std::vector<std::string>& args)>;
using OnComplete = using OnComplete =
std::function<void(const NonElidedVector<lsCompletionItem>& results, std::function<void(const std::vector<lsCompletionItem>& results,
bool is_cached_result)>; bool is_cached_result)>;
struct ParseRequest { struct ParseRequest {

View File

@ -16,7 +16,7 @@ struct CodeCompleteCache {
// NOTE: Make sure to access these variables under |WithLock|. // NOTE: Make sure to access these variables under |WithLock|.
optional<std::string> cached_path_; optional<std::string> cached_path_;
optional<lsPosition> cached_completion_position_; optional<lsPosition> cached_completion_position_;
NonElidedVector<lsCompletionItem> cached_results_; std::vector<lsCompletionItem> cached_results_;
std::mutex mutex_; std::mutex mutex_;

View File

@ -71,7 +71,7 @@ bool ShouldDisplayIpcTiming(IpcId id) {
void EmitDiagnostics(WorkingFiles* working_files, void EmitDiagnostics(WorkingFiles* working_files,
std::string path, std::string path,
NonElidedVector<lsDiagnostic> diagnostics) { std::vector<lsDiagnostic> diagnostics) {
// Emit diagnostics. // Emit diagnostics.
Out_TextDocumentPublishDiagnostics out; Out_TextDocumentPublishDiagnostics out;
out.params.uri = lsDocumentUri::FromPath(path); out.params.uri = lsDocumentUri::FromPath(path);

View File

@ -501,7 +501,7 @@ struct IndexFile {
std::vector<IndexVar> vars; std::vector<IndexVar> vars;
// Diagnostics found when indexing this file. Not serialized. // Diagnostics found when indexing this file. Not serialized.
NonElidedVector<lsDiagnostic> diagnostics_; std::vector<lsDiagnostic> diagnostics_;
// File contents at the time of index. Not serialized. // File contents at the time of index. Not serialized.
std::string file_contents_; std::string file_contents_;

View File

@ -493,7 +493,7 @@ struct lsDiagnostic {
std::string message; std::string message;
// Non-serialized set of fixits. // Non-serialized set of fixits.
NonElidedVector<lsTextEdit> fixits_; std::vector<lsTextEdit> fixits_;
}; };
MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, source, message); MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, source, message);
@ -792,7 +792,7 @@ struct lsDocumentOnTypeFormattingOptions {
std::string firstTriggerCharacter; std::string firstTriggerCharacter;
// More trigger characters. // More trigger characters.
NonElidedVector<std::string> moreTriggerCharacter; std::vector<std::string> moreTriggerCharacter;
}; };
MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions, MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions,
firstTriggerCharacter, firstTriggerCharacter,
@ -808,7 +808,7 @@ MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, resolveProvider);
// Execute command options. // Execute command options.
struct lsExecuteCommandOptions { struct lsExecuteCommandOptions {
// The commands to be executed on the server // The commands to be executed on the server
NonElidedVector<std::string> commands; std::vector<std::string> commands;
}; };
MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, commands); MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, commands);
@ -951,7 +951,7 @@ struct Out_TextDocumentPublishDiagnostics
lsDocumentUri uri; lsDocumentUri uri;
// An array of diagnostic information items. // An array of diagnostic information items.
NonElidedVector<lsDiagnostic> diagnostics; std::vector<lsDiagnostic> diagnostics;
}; };
Params params; Params params;
@ -1054,7 +1054,7 @@ struct Out_CquerySetInactiveRegion
: public lsOutMessage<Out_CquerySetInactiveRegion> { : public lsOutMessage<Out_CquerySetInactiveRegion> {
struct Params { struct Params {
lsDocumentUri uri; lsDocumentUri uri;
NonElidedVector<lsRange> inactiveRegions; std::vector<lsRange> inactiveRegions;
}; };
std::string method = "$cquery/setInactiveRegions"; std::string method = "$cquery/setInactiveRegions";
Params params; Params params;
@ -1069,11 +1069,11 @@ struct Out_CqueryPublishSemanticHighlighting
int stableId = 0; int stableId = 0;
SymbolType type = SymbolType::Type; SymbolType type = SymbolType::Type;
bool isTypeMember = false; bool isTypeMember = false;
NonElidedVector<lsRange> ranges; std::vector<lsRange> ranges;
}; };
struct Params { struct Params {
lsDocumentUri uri; lsDocumentUri uri;
NonElidedVector<Symbol> symbols; std::vector<Symbol> symbols;
}; };
std::string method = "$cquery/publishSemanticHighlighting"; std::string method = "$cquery/publishSemanticHighlighting";
Params params; Params params;
@ -1094,6 +1094,6 @@ MAKE_REFLECT_STRUCT(Out_CqueryPublishSemanticHighlighting,
struct Out_LocationList : public lsOutMessage<Out_LocationList> { struct Out_LocationList : public lsOutMessage<Out_LocationList> {
lsRequestId id; lsRequestId id;
NonElidedVector<lsLocation> result; std::vector<lsLocation> result;
}; };
MAKE_REFLECT_STRUCT(Out_LocationList, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_LocationList, jsonrpc, id, result);

View File

@ -34,7 +34,7 @@ struct Out_CqueryCallTree : public lsOutMessage<Out_CqueryCallTree> {
}; };
lsRequestId id; lsRequestId id;
NonElidedVector<CallEntry> result; std::vector<CallEntry> result;
}; };
MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType, int); MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType, int);
MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry, MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry,
@ -45,7 +45,7 @@ MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry,
callType); callType);
MAKE_REFLECT_STRUCT(Out_CqueryCallTree, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_CqueryCallTree, jsonrpc, id, result);
NonElidedVector<Out_CqueryCallTree::CallEntry> BuildInitialCallTree( std::vector<Out_CqueryCallTree::CallEntry> BuildInitialCallTree(
QueryDatabase* db, QueryDatabase* db,
WorkingFiles* working_files, WorkingFiles* working_files,
QueryFuncId root) { QueryFuncId root) {
@ -62,12 +62,12 @@ NonElidedVector<Out_CqueryCallTree::CallEntry> BuildInitialCallTree(
entry.usr = root_func.def->usr; entry.usr = root_func.def->usr;
entry.location = *def_loc; entry.location = *def_loc;
entry.hasCallers = HasCallersOnSelfOrBaseOrDerived(db, root_func); entry.hasCallers = HasCallersOnSelfOrBaseOrDerived(db, root_func);
NonElidedVector<Out_CqueryCallTree::CallEntry> result; std::vector<Out_CqueryCallTree::CallEntry> result;
result.push_back(entry); result.push_back(entry);
return result; return result;
} }
NonElidedVector<Out_CqueryCallTree::CallEntry> BuildExpandCallTree( std::vector<Out_CqueryCallTree::CallEntry> BuildExpandCallTree(
QueryDatabase* db, QueryDatabase* db,
WorkingFiles* working_files, WorkingFiles* working_files,
QueryFuncId root) { QueryFuncId root) {
@ -96,7 +96,7 @@ NonElidedVector<Out_CqueryCallTree::CallEntry> BuildExpandCallTree(
return base + ":" + std::to_string(location.range.start.line + 1); return base + ":" + std::to_string(location.range.start.line + 1);
}; };
NonElidedVector<Out_CqueryCallTree::CallEntry> result; std::vector<Out_CqueryCallTree::CallEntry> result;
std::unordered_set<QueryLocation> seen_locations; std::unordered_set<QueryLocation> seen_locations;
auto handle_caller = [&](QueryFuncRef caller, auto handle_caller = [&](QueryFuncRef caller,

View File

@ -16,7 +16,7 @@ struct Out_CqueryTypeHierarchyTree
struct TypeEntry { struct TypeEntry {
std::string name; std::string name;
optional<lsLocation> location; optional<lsLocation> location;
NonElidedVector<TypeEntry> children; std::vector<TypeEntry> children;
}; };
lsRequestId id; lsRequestId id;
optional<TypeEntry> result; optional<TypeEntry> result;
@ -27,7 +27,7 @@ MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree::TypeEntry,
children); children);
MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree, jsonrpc, id, result);
NonElidedVector<Out_CqueryTypeHierarchyTree::TypeEntry> std::vector<Out_CqueryTypeHierarchyTree::TypeEntry>
BuildParentInheritanceHierarchyForType(QueryDatabase* db, BuildParentInheritanceHierarchyForType(QueryDatabase* db,
WorkingFiles* working_files, WorkingFiles* working_files,
QueryTypeId root) { QueryTypeId root) {
@ -35,7 +35,7 @@ BuildParentInheritanceHierarchyForType(QueryDatabase* db,
if (!root_type.def) if (!root_type.def)
return {}; return {};
NonElidedVector<Out_CqueryTypeHierarchyTree::TypeEntry> parent_entries; std::vector<Out_CqueryTypeHierarchyTree::TypeEntry> parent_entries;
parent_entries.reserve(root_type.def->parents.size()); parent_entries.reserve(root_type.def->parents.size());
for (QueryTypeId parent_id : root_type.def->parents) { for (QueryTypeId parent_id : root_type.def->parents) {
@ -95,7 +95,7 @@ BuildInheritanceHierarchyForType(QueryDatabase* db,
return entry; return entry;
} }
NonElidedVector<Out_CqueryTypeHierarchyTree::TypeEntry> std::vector<Out_CqueryTypeHierarchyTree::TypeEntry>
BuildParentInheritanceHierarchyForFunc(QueryDatabase* db, BuildParentInheritanceHierarchyForFunc(QueryDatabase* db,
WorkingFiles* working_files, WorkingFiles* working_files,
QueryFuncId root) { QueryFuncId root) {
@ -115,7 +115,7 @@ BuildParentInheritanceHierarchyForFunc(QueryDatabase* db,
parent_entry.children = BuildParentInheritanceHierarchyForFunc( parent_entry.children = BuildParentInheritanceHierarchyForFunc(
db, working_files, *root_func.def->base); db, working_files, *root_func.def->base);
NonElidedVector<Out_CqueryTypeHierarchyTree::TypeEntry> entries; std::vector<Out_CqueryTypeHierarchyTree::TypeEntry> entries;
entries.push_back(parent_entry); entries.push_back(parent_entry);
return entries; return entries;
} }

View File

@ -254,7 +254,7 @@ struct Ipc_TextDocumentCodeAction
// a code action is run. // a code action is run.
struct lsCodeActionContext { struct lsCodeActionContext {
// An array of diagnostics. // An array of diagnostics.
NonElidedVector<lsDiagnostic> diagnostics; std::vector<lsDiagnostic> diagnostics;
}; };
// Params for the CodeActionRequest // Params for the CodeActionRequest
struct lsCodeActionParams { struct lsCodeActionParams {
@ -282,12 +282,12 @@ struct Out_TextDocumentCodeAction
: public lsOutMessage<Out_TextDocumentCodeAction> { : public lsOutMessage<Out_TextDocumentCodeAction> {
struct CommandArgs { struct CommandArgs {
lsDocumentUri textDocumentUri; lsDocumentUri textDocumentUri;
NonElidedVector<lsTextEdit> edits; std::vector<lsTextEdit> edits;
}; };
using Command = lsCommand<CommandArgs>; using Command = lsCommand<CommandArgs>;
lsRequestId id; lsRequestId id;
NonElidedVector<Command> result; std::vector<Command> result;
}; };
MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(Out_TextDocumentCodeAction::CommandArgs, MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(Out_TextDocumentCodeAction::CommandArgs,
textDocumentUri, textDocumentUri,

View File

@ -13,7 +13,7 @@ MAKE_REFLECT_EMPTY_STRUCT(lsCodeLensUserData);
struct lsCodeLensCommandArguments { struct lsCodeLensCommandArguments {
lsDocumentUri uri; lsDocumentUri uri;
lsPosition position; lsPosition position;
NonElidedVector<lsLocation> locations; std::vector<lsLocation> locations;
}; };
void Reflect(Writer& visitor, lsCodeLensCommandArguments& value) { void Reflect(Writer& visitor, lsCodeLensCommandArguments& value) {
visitor.StartArray(); visitor.StartArray();
@ -45,7 +45,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentCodeLens);
struct Out_TextDocumentCodeLens struct Out_TextDocumentCodeLens
: public lsOutMessage<Out_TextDocumentCodeLens> { : public lsOutMessage<Out_TextDocumentCodeLens> {
lsRequestId id; lsRequestId id;
NonElidedVector<lsCodeLens<lsCodeLensUserData, lsCodeLensCommandArguments>> std::vector<lsCodeLens<lsCodeLensUserData, lsCodeLensCommandArguments>>
result; result;
}; };
MAKE_REFLECT_STRUCT(Out_TextDocumentCodeLens, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_TextDocumentCodeLens, jsonrpc, id, result);

View File

@ -20,7 +20,7 @@ struct lsTextDocumentCompleteResult {
// this list. // this list.
bool isIncomplete = false; bool isIncomplete = false;
// The completion items. // The completion items.
NonElidedVector<lsCompletionItem> items; std::vector<lsCompletionItem> items;
}; };
MAKE_REFLECT_STRUCT(lsTextDocumentCompleteResult, isIncomplete, items); MAKE_REFLECT_STRUCT(lsTextDocumentCompleteResult, isIncomplete, items);
@ -55,7 +55,7 @@ void FilterCompletionResponse(Out_TextDocumentComplete* complete_response,
if (complete_text.empty()) { if (complete_text.empty()) {
complete_response->result.items.resize(kMaxResultSize); complete_response->result.items.resize(kMaxResultSize);
} else { } else {
NonElidedVector<lsCompletionItem> filtered_result; std::vector<lsCompletionItem> filtered_result;
filtered_result.reserve(kMaxResultSize); filtered_result.reserve(kMaxResultSize);
std::unordered_set<std::string> inserted; std::unordered_set<std::string> inserted;
@ -157,7 +157,7 @@ struct TextDocumentCompletionHandler : MessageHandler {
ClangCompleteManager::OnComplete callback = std::bind( ClangCompleteManager::OnComplete callback = std::bind(
[this, is_global_completion, existing_completion, request]( [this, is_global_completion, existing_completion, request](
const NonElidedVector<lsCompletionItem>& results, const std::vector<lsCompletionItem>& results,
bool is_cached_result) { bool is_cached_result) {
Out_TextDocumentComplete out; Out_TextDocumentComplete out;
out.id = request->id; out.id = request->id;
@ -195,7 +195,7 @@ struct TextDocumentCompletionHandler : MessageHandler {
}); });
if (is_cache_match) { if (is_cache_match) {
ClangCompleteManager::OnComplete freshen_global = ClangCompleteManager::OnComplete freshen_global =
[this](NonElidedVector<lsCompletionItem> results, [this](std::vector<lsCompletionItem> results,
bool is_cached_result) { bool is_cached_result) {
assert(!is_cached_result); assert(!is_cached_result);

View File

@ -2,7 +2,7 @@
#include "query_utils.h" #include "query_utils.h"
namespace { namespace {
void PushBack(NonElidedVector<lsLocation>* result, void PushBack(std::vector<lsLocation>* result,
optional<lsLocation> location) { optional<lsLocation> location) {
if (location) if (location)
result->push_back(*location); result->push_back(*location);
@ -21,7 +21,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentDefinition);
struct Out_TextDocumentDefinition struct Out_TextDocumentDefinition
: public lsOutMessage<Out_TextDocumentDefinition> { : public lsOutMessage<Out_TextDocumentDefinition> {
lsRequestId id; lsRequestId id;
NonElidedVector<lsLocation> result; std::vector<lsLocation> result;
}; };
MAKE_REFLECT_STRUCT(Out_TextDocumentDefinition, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_TextDocumentDefinition, jsonrpc, id, result);

View File

@ -34,7 +34,7 @@ MAKE_REFLECT_STRUCT(lsDocumentLink, range, target);
struct Out_TextDocumentDocumentLink struct Out_TextDocumentDocumentLink
: public lsOutMessage<Out_TextDocumentDocumentLink> { : public lsOutMessage<Out_TextDocumentDocumentLink> {
lsRequestId id; lsRequestId id;
NonElidedVector<lsDocumentLink> result; std::vector<lsDocumentLink> result;
}; };
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentLink, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentLink, jsonrpc, id, result);

View File

@ -20,7 +20,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentDocumentSymbol);
struct Out_TextDocumentDocumentSymbol struct Out_TextDocumentDocumentSymbol
: public lsOutMessage<Out_TextDocumentDocumentSymbol> { : public lsOutMessage<Out_TextDocumentDocumentSymbol> {
lsRequestId id; lsRequestId id;
NonElidedVector<lsSymbolInformation> result; std::vector<lsSymbolInformation> result;
}; };
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentSymbol, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentSymbol, jsonrpc, id, result);

View File

@ -15,7 +15,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentDocumentHighlight);
struct Out_TextDocumentDocumentHighlight struct Out_TextDocumentDocumentHighlight
: public lsOutMessage<Out_TextDocumentDocumentHighlight> { : public lsOutMessage<Out_TextDocumentDocumentHighlight> {
lsRequestId id; lsRequestId id;
NonElidedVector<lsDocumentHighlight> result; std::vector<lsDocumentHighlight> result;
}; };
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentHighlight, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentHighlight, jsonrpc, id, result);

View File

@ -33,7 +33,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentReferences);
struct Out_TextDocumentReferences struct Out_TextDocumentReferences
: public lsOutMessage<Out_TextDocumentReferences> { : public lsOutMessage<Out_TextDocumentReferences> {
lsRequestId id; lsRequestId id;
NonElidedVector<lsLocation> result; std::vector<lsLocation> result;
}; };
MAKE_REFLECT_STRUCT(Out_TextDocumentReferences, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_TextDocumentReferences, jsonrpc, id, result);

View File

@ -47,7 +47,7 @@ MAKE_REFLECT_STRUCT(lsSignatureInformation, label, documentation, parameters);
// active and only one active parameter. // active and only one active parameter.
struct lsSignatureHelp { struct lsSignatureHelp {
// One or more signatures. // One or more signatures.
NonElidedVector<lsSignatureInformation> signatures; std::vector<lsSignatureInformation> signatures;
// The active signature. If omitted or the value lies outside the // The active signature. If omitted or the value lies outside the
// range of `signatures` the value defaults to zero or is ignored if // range of `signatures` the value defaults to zero or is ignored if
@ -100,7 +100,7 @@ struct TextDocumentSignatureHelpHandler : MessageHandler {
ClangCompleteManager::OnComplete callback = std::bind( ClangCompleteManager::OnComplete callback = std::bind(
[this](BaseIpcMessage* message, std::string search, int active_param, [this](BaseIpcMessage* message, std::string search, int active_param,
const NonElidedVector<lsCompletionItem>& results, const std::vector<lsCompletionItem>& results,
bool is_cached_result) { bool is_cached_result) {
auto msg = message->As<Ipc_TextDocumentSignatureHelp>(); auto msg = message->As<Ipc_TextDocumentSignatureHelp>();

View File

@ -20,7 +20,7 @@ REGISTER_IPC_MESSAGE(Ipc_WorkspaceSymbol);
struct Out_WorkspaceSymbol : public lsOutMessage<Out_WorkspaceSymbol> { struct Out_WorkspaceSymbol : public lsOutMessage<Out_WorkspaceSymbol> {
lsRequestId id; lsRequestId id;
NonElidedVector<lsSymbolInformation> result; std::vector<lsSymbolInformation> result;
}; };
MAKE_REFLECT_STRUCT(Out_WorkspaceSymbol, jsonrpc, id, result); MAKE_REFLECT_STRUCT(Out_WorkspaceSymbol, jsonrpc, id, result);

View File

@ -427,7 +427,7 @@ optional<lsLocation> GetLsLocation(QueryDatabase* db,
return lsLocation(uri, *range); return lsLocation(uri, *range);
} }
NonElidedVector<lsLocation> GetLsLocations( std::vector<lsLocation> GetLsLocations(
QueryDatabase* db, QueryDatabase* db,
WorkingFiles* working_files, WorkingFiles* working_files,
const std::vector<QueryLocation>& locations) { const std::vector<QueryLocation>& locations) {
@ -440,7 +440,7 @@ NonElidedVector<lsLocation> GetLsLocations(
unique_locations.insert(*location); unique_locations.insert(*location);
} }
NonElidedVector<lsLocation> result; std::vector<lsLocation> result;
result.reserve(unique_locations.size()); result.reserve(unique_locations.size());
result.assign(unique_locations.begin(), unique_locations.end()); result.assign(unique_locations.begin(), unique_locations.end());
return result; return result;

View File

@ -52,7 +52,7 @@ lsDocumentUri GetLsDocumentUri(QueryDatabase* db, QueryFileId file_id);
optional<lsLocation> GetLsLocation(QueryDatabase* db, optional<lsLocation> GetLsLocation(QueryDatabase* db,
WorkingFiles* working_files, WorkingFiles* working_files,
const QueryLocation& location); const QueryLocation& location);
NonElidedVector<lsLocation> GetLsLocations( std::vector<lsLocation> GetLsLocations(
QueryDatabase* db, QueryDatabase* db,
WorkingFiles* working_files, WorkingFiles* working_files,
const std::vector<QueryLocation>& locations); const std::vector<QueryLocation>& locations);

View File

@ -63,9 +63,6 @@ struct IndexFile;
visitor.EndArray(); \ visitor.EndArray(); \
} }
template <typename T>
struct NonElidedVector : public std::vector<T> {};
// API: // API:
/* /*
template<typename TVisitor, typename T> template<typename TVisitor, typename T>
@ -145,16 +142,6 @@ void ReflectMember(Writer& visitor, const char* name, std::vector<T>& values) {
visitor.EndArray(); visitor.EndArray();
} }
template <typename T> template <typename T>
void ReflectMember(Writer& visitor,
const char* name,
NonElidedVector<T>& values) {
visitor.Key(name);
visitor.StartArray();
for (auto& value : values)
Reflect(visitor, value);
visitor.EndArray();
}
template <typename T>
void ReflectMember(Writer& visitor, const char* name, optional<T>& value) { void ReflectMember(Writer& visitor, const char* name, optional<T>& value) {
if (!value) if (!value)
return; return;