Skip to content

Commit

Permalink
No more NonElidedVector
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdufault committed Dec 12, 2017
1 parent 2cef928 commit d9e0a77
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 60 deletions.
6 changes: 3 additions & 3 deletions src/clang_complete.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void TryEnsureDocumentParsed(ClangCompleteManager* manager,
return;
}

NonElidedVector<lsDiagnostic> ls_diagnostics;
std::vector<lsDiagnostic> ls_diagnostics;
unsigned num_diagnostics = clang_getNumDiagnostics((*tu)->cx_tu);
for (unsigned i = 0; i < num_diagnostics; ++i) {
optional<lsDiagnostic> diagnostic = BuildAndDisposeDiagnostic(
Expand Down Expand Up @@ -412,7 +412,7 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {

{
if (request->on_complete) {
NonElidedVector<lsCompletionItem> ls_result;
std::vector<lsCompletionItem> ls_result;
ls_result.reserve(cx_results->NumResults);

timer.Reset();
Expand Down Expand Up @@ -487,7 +487,7 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
}

size_t num_diagnostics = clang_getNumDiagnostics(session->tu->cx_tu);
NonElidedVector<lsDiagnostic> ls_diagnostics;
std::vector<lsDiagnostic> 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);
Expand Down
4 changes: 2 additions & 2 deletions src/clang_complete.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ struct CompletionSession
struct ClangCompleteManager {
using OnDiagnostic =
std::function<void(std::string path,
NonElidedVector<lsDiagnostic> diagnostics)>;
std::vector<lsDiagnostic> diagnostics)>;
using OnIndex = std::function<void(ClangTranslationUnit* tu,
const std::vector<CXUnsavedFile>& unsaved,
const std::string& path,
const std::vector<std::string>& args)>;
using OnComplete =
std::function<void(const NonElidedVector<lsCompletionItem>& results,
std::function<void(const std::vector<lsCompletionItem>& results,
bool is_cached_result)>;

struct ParseRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/code_complete_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct CodeCompleteCache {
// NOTE: Make sure to access these variables under |WithLock|.
optional<std::string> cached_path_;
optional<lsPosition> cached_completion_position_;
NonElidedVector<lsCompletionItem> cached_results_;
std::vector<lsCompletionItem> cached_results_;

std::mutex mutex_;

Expand Down
2 changes: 1 addition & 1 deletion src/command_line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bool ShouldDisplayIpcTiming(IpcId id) {

void EmitDiagnostics(WorkingFiles* working_files,
std::string path,
NonElidedVector<lsDiagnostic> diagnostics) {
std::vector<lsDiagnostic> diagnostics) {
// Emit diagnostics.
Out_TextDocumentPublishDiagnostics out;
out.params.uri = lsDocumentUri::FromPath(path);
Expand Down
2 changes: 1 addition & 1 deletion src/indexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ struct IndexFile {
std::vector<IndexVar> vars;

// Diagnostics found when indexing this file. Not serialized.
NonElidedVector<lsDiagnostic> diagnostics_;
std::vector<lsDiagnostic> diagnostics_;
// File contents at the time of index. Not serialized.
std::string file_contents_;

Expand Down
16 changes: 8 additions & 8 deletions src/language_server_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ struct lsDiagnostic {
std::string message;

// Non-serialized set of fixits.
NonElidedVector<lsTextEdit> fixits_;
std::vector<lsTextEdit> fixits_;
};
MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, source, message);

Expand Down Expand Up @@ -792,7 +792,7 @@ struct lsDocumentOnTypeFormattingOptions {
std::string firstTriggerCharacter;

// More trigger characters.
NonElidedVector<std::string> moreTriggerCharacter;
std::vector<std::string> moreTriggerCharacter;
};
MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions,
firstTriggerCharacter,
Expand All @@ -808,7 +808,7 @@ MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, resolveProvider);
// Execute command options.
struct lsExecuteCommandOptions {
// The commands to be executed on the server
NonElidedVector<std::string> commands;
std::vector<std::string> commands;
};
MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, commands);

Expand Down Expand Up @@ -951,7 +951,7 @@ struct Out_TextDocumentPublishDiagnostics
lsDocumentUri uri;

// An array of diagnostic information items.
NonElidedVector<lsDiagnostic> diagnostics;
std::vector<lsDiagnostic> diagnostics;
};

Params params;
Expand Down Expand Up @@ -1054,7 +1054,7 @@ struct Out_CquerySetInactiveRegion
: public lsOutMessage<Out_CquerySetInactiveRegion> {
struct Params {
lsDocumentUri uri;
NonElidedVector<lsRange> inactiveRegions;
std::vector<lsRange> inactiveRegions;
};
std::string method = "$cquery/setInactiveRegions";
Params params;
Expand All @@ -1069,11 +1069,11 @@ struct Out_CqueryPublishSemanticHighlighting
int stableId = 0;
SymbolType type = SymbolType::Type;
bool isTypeMember = false;
NonElidedVector<lsRange> ranges;
std::vector<lsRange> ranges;
};
struct Params {
lsDocumentUri uri;
NonElidedVector<Symbol> symbols;
std::vector<Symbol> symbols;
};
std::string method = "$cquery/publishSemanticHighlighting";
Params params;
Expand All @@ -1094,6 +1094,6 @@ MAKE_REFLECT_STRUCT(Out_CqueryPublishSemanticHighlighting,

struct Out_LocationList : public lsOutMessage<Out_LocationList> {
lsRequestId id;
NonElidedVector<lsLocation> result;
std::vector<lsLocation> result;
};
MAKE_REFLECT_STRUCT(Out_LocationList, jsonrpc, id, result);
10 changes: 5 additions & 5 deletions src/messages/cquery_call_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct Out_CqueryCallTree : public lsOutMessage<Out_CqueryCallTree> {
};

lsRequestId id;
NonElidedVector<CallEntry> result;
std::vector<CallEntry> result;
};
MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType, int);
MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry,
Expand All @@ -45,7 +45,7 @@ MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry,
callType);
MAKE_REFLECT_STRUCT(Out_CqueryCallTree, jsonrpc, id, result);

NonElidedVector<Out_CqueryCallTree::CallEntry> BuildInitialCallTree(
std::vector<Out_CqueryCallTree::CallEntry> BuildInitialCallTree(
QueryDatabase* db,
WorkingFiles* working_files,
QueryFuncId root) {
Expand All @@ -62,12 +62,12 @@ NonElidedVector<Out_CqueryCallTree::CallEntry> BuildInitialCallTree(
entry.usr = root_func.def->usr;
entry.location = *def_loc;
entry.hasCallers = HasCallersOnSelfOrBaseOrDerived(db, root_func);
NonElidedVector<Out_CqueryCallTree::CallEntry> result;
std::vector<Out_CqueryCallTree::CallEntry> result;
result.push_back(entry);
return result;
}

NonElidedVector<Out_CqueryCallTree::CallEntry> BuildExpandCallTree(
std::vector<Out_CqueryCallTree::CallEntry> BuildExpandCallTree(
QueryDatabase* db,
WorkingFiles* working_files,
QueryFuncId root) {
Expand Down Expand Up @@ -96,7 +96,7 @@ NonElidedVector<Out_CqueryCallTree::CallEntry> BuildExpandCallTree(
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;

auto handle_caller = [&](QueryFuncRef caller,
Expand Down
10 changes: 5 additions & 5 deletions src/messages/cquery_type_hierarchy_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct Out_CqueryTypeHierarchyTree
struct TypeEntry {
std::string name;
optional<lsLocation> location;
NonElidedVector<TypeEntry> children;
std::vector<TypeEntry> children;
};
lsRequestId id;
optional<TypeEntry> result;
Expand All @@ -27,15 +27,15 @@ MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree::TypeEntry,
children);
MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree, jsonrpc, id, result);

NonElidedVector<Out_CqueryTypeHierarchyTree::TypeEntry>
std::vector<Out_CqueryTypeHierarchyTree::TypeEntry>
BuildParentInheritanceHierarchyForType(QueryDatabase* db,
WorkingFiles* working_files,
QueryTypeId root) {
QueryType& root_type = db->types[root.id];
if (!root_type.def)
return {};

NonElidedVector<Out_CqueryTypeHierarchyTree::TypeEntry> parent_entries;
std::vector<Out_CqueryTypeHierarchyTree::TypeEntry> parent_entries;
parent_entries.reserve(root_type.def->parents.size());

for (QueryTypeId parent_id : root_type.def->parents) {
Expand Down Expand Up @@ -95,7 +95,7 @@ BuildInheritanceHierarchyForType(QueryDatabase* db,
return entry;
}

NonElidedVector<Out_CqueryTypeHierarchyTree::TypeEntry>
std::vector<Out_CqueryTypeHierarchyTree::TypeEntry>
BuildParentInheritanceHierarchyForFunc(QueryDatabase* db,
WorkingFiles* working_files,
QueryFuncId root) {
Expand All @@ -115,7 +115,7 @@ BuildParentInheritanceHierarchyForFunc(QueryDatabase* db,
parent_entry.children = BuildParentInheritanceHierarchyForFunc(
db, working_files, *root_func.def->base);

NonElidedVector<Out_CqueryTypeHierarchyTree::TypeEntry> entries;
std::vector<Out_CqueryTypeHierarchyTree::TypeEntry> entries;
entries.push_back(parent_entry);
return entries;
}
Expand Down
6 changes: 3 additions & 3 deletions src/messages/text_document_code_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ struct Ipc_TextDocumentCodeAction
// a code action is run.
struct lsCodeActionContext {
// An array of diagnostics.
NonElidedVector<lsDiagnostic> diagnostics;
std::vector<lsDiagnostic> diagnostics;
};
// Params for the CodeActionRequest
struct lsCodeActionParams {
Expand Down Expand Up @@ -282,12 +282,12 @@ struct Out_TextDocumentCodeAction
: public lsOutMessage<Out_TextDocumentCodeAction> {
struct CommandArgs {
lsDocumentUri textDocumentUri;
NonElidedVector<lsTextEdit> edits;
std::vector<lsTextEdit> edits;
};
using Command = lsCommand<CommandArgs>;

lsRequestId id;
NonElidedVector<Command> result;
std::vector<Command> result;
};
MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(Out_TextDocumentCodeAction::CommandArgs,
textDocumentUri,
Expand Down
4 changes: 2 additions & 2 deletions src/messages/text_document_code_lens.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MAKE_REFLECT_EMPTY_STRUCT(lsCodeLensUserData);
struct lsCodeLensCommandArguments {
lsDocumentUri uri;
lsPosition position;
NonElidedVector<lsLocation> locations;
std::vector<lsLocation> locations;
};
void Reflect(Writer& visitor, lsCodeLensCommandArguments& value) {
visitor.StartArray();
Expand Down Expand Up @@ -45,7 +45,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentCodeLens);
struct Out_TextDocumentCodeLens
: public lsOutMessage<Out_TextDocumentCodeLens> {
lsRequestId id;
NonElidedVector<lsCodeLens<lsCodeLensUserData, lsCodeLensCommandArguments>>
std::vector<lsCodeLens<lsCodeLensUserData, lsCodeLensCommandArguments>>
result;
};
MAKE_REFLECT_STRUCT(Out_TextDocumentCodeLens, jsonrpc, id, result);
Expand Down
8 changes: 4 additions & 4 deletions src/messages/text_document_completion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct lsTextDocumentCompleteResult {
// this list.
bool isIncomplete = false;
// The completion items.
NonElidedVector<lsCompletionItem> items;
std::vector<lsCompletionItem> items;
};
MAKE_REFLECT_STRUCT(lsTextDocumentCompleteResult, isIncomplete, items);

Expand Down Expand Up @@ -55,7 +55,7 @@ void FilterCompletionResponse(Out_TextDocumentComplete* complete_response,
if (complete_text.empty()) {
complete_response->result.items.resize(kMaxResultSize);
} else {
NonElidedVector<lsCompletionItem> filtered_result;
std::vector<lsCompletionItem> filtered_result;
filtered_result.reserve(kMaxResultSize);

std::unordered_set<std::string> inserted;
Expand Down Expand Up @@ -157,7 +157,7 @@ struct TextDocumentCompletionHandler : MessageHandler {

ClangCompleteManager::OnComplete callback = std::bind(
[this, is_global_completion, existing_completion, request](
const NonElidedVector<lsCompletionItem>& results,
const std::vector<lsCompletionItem>& results,
bool is_cached_result) {
Out_TextDocumentComplete out;
out.id = request->id;
Expand Down Expand Up @@ -195,7 +195,7 @@ struct TextDocumentCompletionHandler : MessageHandler {
});
if (is_cache_match) {
ClangCompleteManager::OnComplete freshen_global =
[this](NonElidedVector<lsCompletionItem> results,
[this](std::vector<lsCompletionItem> results,
bool is_cached_result) {
assert(!is_cached_result);

Expand Down
4 changes: 2 additions & 2 deletions src/messages/text_document_definition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "query_utils.h"

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

Expand Down
2 changes: 1 addition & 1 deletion src/messages/text_document_document_link.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MAKE_REFLECT_STRUCT(lsDocumentLink, range, target);
struct Out_TextDocumentDocumentLink
: public lsOutMessage<Out_TextDocumentDocumentLink> {
lsRequestId id;
NonElidedVector<lsDocumentLink> result;
std::vector<lsDocumentLink> result;
};
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentLink, jsonrpc, id, result);

Expand Down
2 changes: 1 addition & 1 deletion src/messages/text_document_document_symbol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentDocumentSymbol);
struct Out_TextDocumentDocumentSymbol
: public lsOutMessage<Out_TextDocumentDocumentSymbol> {
lsRequestId id;
NonElidedVector<lsSymbolInformation> result;
std::vector<lsSymbolInformation> result;
};
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentSymbol, jsonrpc, id, result);

Expand Down
2 changes: 1 addition & 1 deletion src/messages/text_document_highlight.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentDocumentHighlight);
struct Out_TextDocumentDocumentHighlight
: public lsOutMessage<Out_TextDocumentDocumentHighlight> {
lsRequestId id;
NonElidedVector<lsDocumentHighlight> result;
std::vector<lsDocumentHighlight> result;
};
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentHighlight, jsonrpc, id, result);

Expand Down
2 changes: 1 addition & 1 deletion src/messages/text_document_references.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ REGISTER_IPC_MESSAGE(Ipc_TextDocumentReferences);
struct Out_TextDocumentReferences
: public lsOutMessage<Out_TextDocumentReferences> {
lsRequestId id;
NonElidedVector<lsLocation> result;
std::vector<lsLocation> result;
};
MAKE_REFLECT_STRUCT(Out_TextDocumentReferences, jsonrpc, id, result);

Expand Down
4 changes: 2 additions & 2 deletions src/messages/text_document_signature_help.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ MAKE_REFLECT_STRUCT(lsSignatureInformation, label, documentation, parameters);
// active and only one active parameter.
struct lsSignatureHelp {
// One or more signatures.
NonElidedVector<lsSignatureInformation> signatures;
std::vector<lsSignatureInformation> signatures;

// The active signature. If omitted or the value lies outside the
// range of `signatures` the value defaults to zero or is ignored if
Expand Down Expand Up @@ -100,7 +100,7 @@ struct TextDocumentSignatureHelpHandler : MessageHandler {

ClangCompleteManager::OnComplete callback = std::bind(
[this](BaseIpcMessage* message, std::string search, int active_param,
const NonElidedVector<lsCompletionItem>& results,
const std::vector<lsCompletionItem>& results,
bool is_cached_result) {
auto msg = message->As<Ipc_TextDocumentSignatureHelp>();

Expand Down
2 changes: 1 addition & 1 deletion src/messages/workspace_symbol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ REGISTER_IPC_MESSAGE(Ipc_WorkspaceSymbol);

struct Out_WorkspaceSymbol : public lsOutMessage<Out_WorkspaceSymbol> {
lsRequestId id;
NonElidedVector<lsSymbolInformation> result;
std::vector<lsSymbolInformation> result;
};
MAKE_REFLECT_STRUCT(Out_WorkspaceSymbol, jsonrpc, id, result);

Expand Down
Loading

0 comments on commit d9e0a77

Please sign in to comment.