Fix clang warnings about uninitialized timestamp field

Closes #1241
This commit is contained in:
Maxime Coste 2017-02-27 20:29:53 +00:00
parent 72bea292f8
commit e5e705e151
2 changed files with 13 additions and 5 deletions

View File

@ -181,7 +181,7 @@ InsertCompletion complete_word(const SelectionList& sels, const OptionManager& o
candidates.push_back({m.candidate().str(), "", std::move(menu_entry)}); candidates.push_back({m.candidate().str(), "", std::move(menu_entry)});
} }
return { word_begin, cursor_pos, std::move(candidates), buffer.timestamp() }; return { std::move(candidates), word_begin, cursor_pos, buffer.timestamp() };
} }
template<bool require_slash> template<bool require_slash>
@ -235,7 +235,7 @@ InsertCompletion complete_filename(const SelectionList& sels,
} }
if (candidates.empty()) if (candidates.empty())
return {}; return {};
return { begin.coord(), pos.coord(), std::move(candidates), buffer.timestamp() }; return { std::move(candidates), begin.coord(), pos.coord(), buffer.timestamp() };
} }
InsertCompletion complete_option(const SelectionList& sels, InsertCompletion complete_option(const SelectionList& sels,
@ -309,7 +309,7 @@ InsertCompletion complete_option(const SelectionList& sels,
candidates.push_back({ match.candidate().str(), match.docstring.str(), candidates.push_back({ match.candidate().str(), match.docstring.str(),
std::move(match.menu_entry) }); std::move(match.menu_entry) });
return { coord, end, std::move(candidates), timestamp }; return { std::move(candidates), coord, end, timestamp };
} }
} }
return {}; return {};
@ -341,7 +341,7 @@ InsertCompletion complete_line(const SelectionList& sels, const OptionManager& o
return {}; return {};
std::sort(candidates.begin(), candidates.end()); std::sort(candidates.begin(), candidates.end());
candidates.erase(std::unique(candidates.begin(), candidates.end()), candidates.end()); candidates.erase(std::unique(candidates.begin(), candidates.end()), candidates.end());
return { cursor_pos.line, cursor_pos, std::move(candidates), buffer.timestamp() }; return { std::move(candidates), cursor_pos.line, cursor_pos, buffer.timestamp() };
} }
} }

View File

@ -64,11 +64,19 @@ struct InsertCompletion
using CandidateList = Vector<Candidate, MemoryDomain::Completion>; using CandidateList = Vector<Candidate, MemoryDomain::Completion>;
CandidateList candidates;
BufferCoord begin; BufferCoord begin;
BufferCoord end; BufferCoord end;
CandidateList candidates;
size_t timestamp; size_t timestamp;
InsertCompletion() : timestamp{0} {}
InsertCompletion(CandidateList candidates,
BufferCoord begin, BufferCoord end,
size_t timestamp)
: candidates{std::move(candidates)}, begin{begin}, end{end},
timestamp{timestamp} {}
bool is_valid() const { return not candidates.empty(); } bool is_valid() const { return not candidates.empty(); }
}; };