diff --git a/src/clang_complete.cc b/src/clang_complete.cc index 660b263f..47757581 100644 --- a/src/clang_complete.cc +++ b/src/clang_complete.cc @@ -319,7 +319,7 @@ void TryEnsureDocumentParsed(ClangCompleteManager* manager, return; } - NonElidedVector ls_diagnostics; + std::vector ls_diagnostics; unsigned num_diagnostics = clang_getNumDiagnostics((*tu)->cx_tu); for (unsigned i = 0; i < num_diagnostics; ++i) { optional diagnostic = BuildAndDisposeDiagnostic( @@ -412,7 +412,7 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) { { if (request->on_complete) { - NonElidedVector ls_result; + std::vector ls_result; ls_result.reserve(cx_results->NumResults); timer.Reset(); @@ -487,7 +487,7 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) { } size_t num_diagnostics = clang_getNumDiagnostics(session->tu->cx_tu); - NonElidedVector ls_diagnostics; + std::vector ls_diagnostics; ls_diagnostics.reserve(num_diagnostics); for (unsigned i = 0; i < num_diagnostics; ++i) { CXDiagnostic cx_diag = clang_getDiagnostic(session->tu->cx_tu, i); diff --git a/src/clang_complete.h b/src/clang_complete.h index 936b26eb..fda498d6 100644 --- a/src/clang_complete.h +++ b/src/clang_complete.h @@ -39,13 +39,13 @@ struct CompletionSession struct ClangCompleteManager { using OnDiagnostic = std::function diagnostics)>; + std::vector diagnostics)>; using OnIndex = std::function& unsaved, const std::string& path, const std::vector& args)>; using OnComplete = - std::function& results, + std::function& results, bool is_cached_result)>; struct ParseRequest { diff --git a/src/code_complete_cache.h b/src/code_complete_cache.h index 9c0e7231..fca4b1e6 100644 --- a/src/code_complete_cache.h +++ b/src/code_complete_cache.h @@ -16,7 +16,7 @@ struct CodeCompleteCache { // NOTE: Make sure to access these variables under |WithLock|. optional cached_path_; optional cached_completion_position_; - NonElidedVector cached_results_; + std::vector cached_results_; std::mutex mutex_; diff --git a/src/command_line.cc b/src/command_line.cc index 89d881b5..4f87e93a 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -71,7 +71,7 @@ bool ShouldDisplayIpcTiming(IpcId id) { void EmitDiagnostics(WorkingFiles* working_files, std::string path, - NonElidedVector diagnostics) { + std::vector diagnostics) { // Emit diagnostics. Out_TextDocumentPublishDiagnostics out; out.params.uri = lsDocumentUri::FromPath(path); diff --git a/src/indexer.h b/src/indexer.h index d05dfd39..45a0e196 100644 --- a/src/indexer.h +++ b/src/indexer.h @@ -501,7 +501,7 @@ struct IndexFile { std::vector vars; // Diagnostics found when indexing this file. Not serialized. - NonElidedVector diagnostics_; + std::vector diagnostics_; // File contents at the time of index. Not serialized. std::string file_contents_; diff --git a/src/language_server_api.h b/src/language_server_api.h index c55e8050..28e5877a 100644 --- a/src/language_server_api.h +++ b/src/language_server_api.h @@ -493,7 +493,7 @@ struct lsDiagnostic { std::string message; // Non-serialized set of fixits. - NonElidedVector fixits_; + std::vector fixits_; }; MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, source, message); @@ -792,7 +792,7 @@ struct lsDocumentOnTypeFormattingOptions { std::string firstTriggerCharacter; // More trigger characters. - NonElidedVector moreTriggerCharacter; + std::vector moreTriggerCharacter; }; MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions, firstTriggerCharacter, @@ -808,7 +808,7 @@ MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, resolveProvider); // Execute command options. struct lsExecuteCommandOptions { // The commands to be executed on the server - NonElidedVector commands; + std::vector commands; }; MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, commands); @@ -951,7 +951,7 @@ struct Out_TextDocumentPublishDiagnostics lsDocumentUri uri; // An array of diagnostic information items. - NonElidedVector diagnostics; + std::vector diagnostics; }; Params params; @@ -1054,7 +1054,7 @@ struct Out_CquerySetInactiveRegion : public lsOutMessage { struct Params { lsDocumentUri uri; - NonElidedVector inactiveRegions; + std::vector inactiveRegions; }; std::string method = "$cquery/setInactiveRegions"; Params params; @@ -1069,11 +1069,11 @@ struct Out_CqueryPublishSemanticHighlighting int stableId = 0; SymbolType type = SymbolType::Type; bool isTypeMember = false; - NonElidedVector ranges; + std::vector ranges; }; struct Params { lsDocumentUri uri; - NonElidedVector symbols; + std::vector symbols; }; std::string method = "$cquery/publishSemanticHighlighting"; Params params; @@ -1094,6 +1094,6 @@ MAKE_REFLECT_STRUCT(Out_CqueryPublishSemanticHighlighting, struct Out_LocationList : public lsOutMessage { lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_STRUCT(Out_LocationList, jsonrpc, id, result); diff --git a/src/messages/cquery_call_tree.cc b/src/messages/cquery_call_tree.cc index abf2f920..d47effce 100644 --- a/src/messages/cquery_call_tree.cc +++ b/src/messages/cquery_call_tree.cc @@ -34,7 +34,7 @@ struct Out_CqueryCallTree : public lsOutMessage { }; lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType, int); MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry, @@ -45,7 +45,7 @@ MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry, callType); MAKE_REFLECT_STRUCT(Out_CqueryCallTree, jsonrpc, id, result); -NonElidedVector BuildInitialCallTree( +std::vector BuildInitialCallTree( QueryDatabase* db, WorkingFiles* working_files, QueryFuncId root) { @@ -62,12 +62,12 @@ NonElidedVector BuildInitialCallTree( entry.usr = root_func.def->usr; entry.location = *def_loc; entry.hasCallers = HasCallersOnSelfOrBaseOrDerived(db, root_func); - NonElidedVector result; + std::vector result; result.push_back(entry); return result; } -NonElidedVector BuildExpandCallTree( +std::vector BuildExpandCallTree( QueryDatabase* db, WorkingFiles* working_files, QueryFuncId root) { @@ -96,7 +96,7 @@ NonElidedVector BuildExpandCallTree( return base + ":" + std::to_string(location.range.start.line + 1); }; - NonElidedVector result; + std::vector result; std::unordered_set seen_locations; auto handle_caller = [&](QueryFuncRef caller, diff --git a/src/messages/cquery_type_hierarchy_tree.cc b/src/messages/cquery_type_hierarchy_tree.cc index 43e632a2..6144ec73 100644 --- a/src/messages/cquery_type_hierarchy_tree.cc +++ b/src/messages/cquery_type_hierarchy_tree.cc @@ -16,7 +16,7 @@ struct Out_CqueryTypeHierarchyTree struct TypeEntry { std::string name; optional location; - NonElidedVector children; + std::vector children; }; lsRequestId id; optional result; @@ -27,7 +27,7 @@ MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree::TypeEntry, children); MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree, jsonrpc, id, result); -NonElidedVector +std::vector BuildParentInheritanceHierarchyForType(QueryDatabase* db, WorkingFiles* working_files, QueryTypeId root) { @@ -35,7 +35,7 @@ BuildParentInheritanceHierarchyForType(QueryDatabase* db, if (!root_type.def) return {}; - NonElidedVector parent_entries; + std::vector parent_entries; parent_entries.reserve(root_type.def->parents.size()); for (QueryTypeId parent_id : root_type.def->parents) { @@ -95,7 +95,7 @@ BuildInheritanceHierarchyForType(QueryDatabase* db, return entry; } -NonElidedVector +std::vector BuildParentInheritanceHierarchyForFunc(QueryDatabase* db, WorkingFiles* working_files, QueryFuncId root) { @@ -115,7 +115,7 @@ BuildParentInheritanceHierarchyForFunc(QueryDatabase* db, parent_entry.children = BuildParentInheritanceHierarchyForFunc( db, working_files, *root_func.def->base); - NonElidedVector entries; + std::vector entries; entries.push_back(parent_entry); return entries; } diff --git a/src/messages/text_document_code_action.cc b/src/messages/text_document_code_action.cc index c1ce2274..5f31e494 100644 --- a/src/messages/text_document_code_action.cc +++ b/src/messages/text_document_code_action.cc @@ -254,7 +254,7 @@ struct Ipc_TextDocumentCodeAction // a code action is run. struct lsCodeActionContext { // An array of diagnostics. - NonElidedVector diagnostics; + std::vector diagnostics; }; // Params for the CodeActionRequest struct lsCodeActionParams { @@ -282,12 +282,12 @@ struct Out_TextDocumentCodeAction : public lsOutMessage { struct CommandArgs { lsDocumentUri textDocumentUri; - NonElidedVector edits; + std::vector edits; }; using Command = lsCommand; lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(Out_TextDocumentCodeAction::CommandArgs, textDocumentUri, diff --git a/src/messages/text_document_code_lens.cc b/src/messages/text_document_code_lens.cc index c77c905d..0b26a8d1 100644 --- a/src/messages/text_document_code_lens.cc +++ b/src/messages/text_document_code_lens.cc @@ -13,7 +13,7 @@ MAKE_REFLECT_EMPTY_STRUCT(lsCodeLensUserData); struct lsCodeLensCommandArguments { lsDocumentUri uri; lsPosition position; - NonElidedVector locations; + std::vector locations; }; void Reflect(Writer& visitor, lsCodeLensCommandArguments& value) { visitor.StartArray(); @@ -45,7 +45,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentCodeLens); struct Out_TextDocumentCodeLens : public lsOutMessage { lsRequestId id; - NonElidedVector> + std::vector> result; }; MAKE_REFLECT_STRUCT(Out_TextDocumentCodeLens, jsonrpc, id, result); diff --git a/src/messages/text_document_completion.cc b/src/messages/text_document_completion.cc index c1d5a767..cae380bd 100644 --- a/src/messages/text_document_completion.cc +++ b/src/messages/text_document_completion.cc @@ -20,7 +20,7 @@ struct lsTextDocumentCompleteResult { // this list. bool isIncomplete = false; // The completion items. - NonElidedVector items; + std::vector items; }; MAKE_REFLECT_STRUCT(lsTextDocumentCompleteResult, isIncomplete, items); @@ -55,7 +55,7 @@ void FilterCompletionResponse(Out_TextDocumentComplete* complete_response, if (complete_text.empty()) { complete_response->result.items.resize(kMaxResultSize); } else { - NonElidedVector filtered_result; + std::vector filtered_result; filtered_result.reserve(kMaxResultSize); std::unordered_set inserted; @@ -157,7 +157,7 @@ struct TextDocumentCompletionHandler : MessageHandler { ClangCompleteManager::OnComplete callback = std::bind( [this, is_global_completion, existing_completion, request]( - const NonElidedVector& results, + const std::vector& results, bool is_cached_result) { Out_TextDocumentComplete out; out.id = request->id; @@ -195,7 +195,7 @@ struct TextDocumentCompletionHandler : MessageHandler { }); if (is_cache_match) { ClangCompleteManager::OnComplete freshen_global = - [this](NonElidedVector results, + [this](std::vector results, bool is_cached_result) { assert(!is_cached_result); diff --git a/src/messages/text_document_definition.cc b/src/messages/text_document_definition.cc index d2303eda..6dd2ae47 100644 --- a/src/messages/text_document_definition.cc +++ b/src/messages/text_document_definition.cc @@ -2,7 +2,7 @@ #include "query_utils.h" namespace { -void PushBack(NonElidedVector* result, +void PushBack(std::vector* result, optional location) { if (location) result->push_back(*location); @@ -21,7 +21,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentDefinition); struct Out_TextDocumentDefinition : public lsOutMessage { lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_STRUCT(Out_TextDocumentDefinition, jsonrpc, id, result); diff --git a/src/messages/text_document_document_link.cc b/src/messages/text_document_document_link.cc index 73467bbe..918e6bd8 100644 --- a/src/messages/text_document_document_link.cc +++ b/src/messages/text_document_document_link.cc @@ -34,7 +34,7 @@ MAKE_REFLECT_STRUCT(lsDocumentLink, range, target); struct Out_TextDocumentDocumentLink : public lsOutMessage { lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentLink, jsonrpc, id, result); diff --git a/src/messages/text_document_document_symbol.cc b/src/messages/text_document_document_symbol.cc index 5aaad4f9..b27f0d4a 100644 --- a/src/messages/text_document_document_symbol.cc +++ b/src/messages/text_document_document_symbol.cc @@ -20,7 +20,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentDocumentSymbol); struct Out_TextDocumentDocumentSymbol : public lsOutMessage { lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentSymbol, jsonrpc, id, result); diff --git a/src/messages/text_document_highlight.cc b/src/messages/text_document_highlight.cc index db435ff6..ed8c7094 100644 --- a/src/messages/text_document_highlight.cc +++ b/src/messages/text_document_highlight.cc @@ -15,7 +15,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentDocumentHighlight); struct Out_TextDocumentDocumentHighlight : public lsOutMessage { lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentHighlight, jsonrpc, id, result); diff --git a/src/messages/text_document_references.cc b/src/messages/text_document_references.cc index 9cc5e158..392ebaaa 100644 --- a/src/messages/text_document_references.cc +++ b/src/messages/text_document_references.cc @@ -33,7 +33,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentReferences); struct Out_TextDocumentReferences : public lsOutMessage { lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_STRUCT(Out_TextDocumentReferences, jsonrpc, id, result); diff --git a/src/messages/text_document_signature_help.cc b/src/messages/text_document_signature_help.cc index 4945544b..a80e06b0 100644 --- a/src/messages/text_document_signature_help.cc +++ b/src/messages/text_document_signature_help.cc @@ -47,7 +47,7 @@ MAKE_REFLECT_STRUCT(lsSignatureInformation, label, documentation, parameters); // active and only one active parameter. struct lsSignatureHelp { // One or more signatures. - NonElidedVector signatures; + std::vector signatures; // The active signature. If omitted or the value lies outside the // range of `signatures` the value defaults to zero or is ignored if @@ -100,7 +100,7 @@ struct TextDocumentSignatureHelpHandler : MessageHandler { ClangCompleteManager::OnComplete callback = std::bind( [this](BaseIpcMessage* message, std::string search, int active_param, - const NonElidedVector& results, + const std::vector& results, bool is_cached_result) { auto msg = message->As(); diff --git a/src/messages/workspace_symbol.cc b/src/messages/workspace_symbol.cc index 7290e3d1..bdef766b 100644 --- a/src/messages/workspace_symbol.cc +++ b/src/messages/workspace_symbol.cc @@ -20,7 +20,7 @@ REGISTER_IPC_MESSAGE(Ipc_WorkspaceSymbol); struct Out_WorkspaceSymbol : public lsOutMessage { lsRequestId id; - NonElidedVector result; + std::vector result; }; MAKE_REFLECT_STRUCT(Out_WorkspaceSymbol, jsonrpc, id, result); diff --git a/src/query_utils.cc b/src/query_utils.cc index 50f26212..99a5ccea 100644 --- a/src/query_utils.cc +++ b/src/query_utils.cc @@ -427,7 +427,7 @@ optional GetLsLocation(QueryDatabase* db, return lsLocation(uri, *range); } -NonElidedVector GetLsLocations( +std::vector GetLsLocations( QueryDatabase* db, WorkingFiles* working_files, const std::vector& locations) { @@ -440,7 +440,7 @@ NonElidedVector GetLsLocations( unique_locations.insert(*location); } - NonElidedVector result; + std::vector result; result.reserve(unique_locations.size()); result.assign(unique_locations.begin(), unique_locations.end()); return result; diff --git a/src/query_utils.h b/src/query_utils.h index e62a51cc..ff08604b 100644 --- a/src/query_utils.h +++ b/src/query_utils.h @@ -52,7 +52,7 @@ lsDocumentUri GetLsDocumentUri(QueryDatabase* db, QueryFileId file_id); optional GetLsLocation(QueryDatabase* db, WorkingFiles* working_files, const QueryLocation& location); -NonElidedVector GetLsLocations( +std::vector GetLsLocations( QueryDatabase* db, WorkingFiles* working_files, const std::vector& locations); diff --git a/src/serializer.h b/src/serializer.h index 98f13729..1dbc5981 100644 --- a/src/serializer.h +++ b/src/serializer.h @@ -63,9 +63,6 @@ struct IndexFile; visitor.EndArray(); \ } -template -struct NonElidedVector : public std::vector {}; - // API: /* template @@ -145,16 +142,6 @@ void ReflectMember(Writer& visitor, const char* name, std::vector& values) { visitor.EndArray(); } template -void ReflectMember(Writer& visitor, - const char* name, - NonElidedVector& values) { - visitor.Key(name); - visitor.StartArray(); - for (auto& value : values) - Reflect(visitor, value); - visitor.EndArray(); -} -template void ReflectMember(Writer& visitor, const char* name, optional& value) { if (!value) return;