From e3e158bf6acea0ce21048fdb85207bcbfc7019da Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 5 Dec 2020 16:18:15 -0500 Subject: [PATCH] Revert "[clang-tidy] Replace push_back with emplace_back" This reverts commit 897759e4dc2a137771569e7c571f47e91917155e. --- src/CLI2.cpp | 24 ++++++++++++------------ src/Eval.cpp | 4 ++-- src/Filter.cpp | 4 ++-- src/Hooks.cpp | 2 +- src/ViewTask.cpp | 4 ++-- src/sort.cpp | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index a6560fded..408da2933 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -339,7 +339,7 @@ void CLI2::add (const std::vector & arguments) std::vector replacement {_original_args[0]}; for (const auto& arg : arguments) - replacement.emplace_back(arg, Lexer::Type::word); + replacement.push_back (A2 (arg, Lexer::Type::word)); for (unsigned int i = 1; i < _original_args.size (); ++i) replacement.push_back (_original_args[i]); @@ -546,7 +546,7 @@ void CLI2::addFilter (const std::string& arg) if (arg.length ()) { std::vector filter; - filter.emplace_back("("); + filter.push_back ("("); std::string lexeme; Lexer::Type type; @@ -555,7 +555,7 @@ void CLI2::addFilter (const std::string& arg) while (lex.token (lexeme, type)) filter.push_back (lexeme); - filter.emplace_back(")"); + filter.push_back (")"); add (filter); analyze (); } @@ -803,7 +803,7 @@ void CLI2::aliasExpansion () Lexer::Type type; Lexer lex (_aliases[raw]); while (lex.token (lexeme, type)) - reconstructed.emplace_back(lexeme, type); + reconstructed.push_back (A2 (lexeme, type)); action = true; changes = true; @@ -833,7 +833,7 @@ void CLI2::aliasExpansion () Lexer::Type type; Lexer lex (_aliases[i.attribute ("raw")]); while (lex.token (lexeme, type)) - reconstructedOriginals.emplace_back(lexeme, type); + reconstructedOriginals.push_back (A2 (lexeme, type)); action = true; changes = true; @@ -1483,7 +1483,7 @@ void CLI2::findIDs () { changes = true; std::string number = a.attribute ("raw"); - _id_ranges.emplace_back(number, number); + _id_ranges.push_back (std::pair (number, number)); } } else if (a._lextype == Lexer::Type::set) @@ -1496,9 +1496,9 @@ void CLI2::findIDs () changes = true; auto hyphen = element.find ("-"); if (hyphen != std::string::npos) - _id_ranges.emplace_back(element.substr (0, hyphen), element.substr (hyphen + 1)); + _id_ranges.push_back (std::pair (element.substr (0, hyphen), element.substr (hyphen + 1))); else - _id_ranges.emplace_back(element, element); + _id_ranges.push_back (std::pair (element, element)); } } @@ -1536,7 +1536,7 @@ void CLI2::findIDs () changes = true; a.unTag ("MODIFICATION"); a.tag ("FILTER"); - _id_ranges.emplace_back(raw, raw); + _id_ranges.push_back (std::pair (raw, raw)); } else if (a._lextype == Lexer::Type::set) { @@ -1551,9 +1551,9 @@ void CLI2::findIDs () changes = true; auto hyphen = element.find ("-"); if (hyphen != std::string::npos) - _id_ranges.emplace_back(element.substr (0, hyphen), element.substr (hyphen + 1)); + _id_ranges.push_back (std::pair (element.substr (0, hyphen), element.substr (hyphen + 1))); else - _id_ranges.emplace_back(element, element); + _id_ranges.push_back (std::pair (element, element)); } } } @@ -2047,7 +2047,7 @@ void CLI2::defaultCommand () while (lex.token (lexeme, type)) { - reconstructedOriginals.emplace_back(lexeme, type); + reconstructedOriginals.push_back (A2 (lexeme, type)); A2 cmd (lexeme, type); cmd.tag ("DEFAULT"); diff --git a/src/Eval.cpp b/src/Eval.cpp index 69aeeac21..445a90e2c 100644 --- a/src/Eval.cpp +++ b/src/Eval.cpp @@ -122,7 +122,7 @@ void Eval::evaluateInfixExpression (const std::string& e, Variant& v) const std::string token; Lexer::Type type; while (l.token (token, type)) - tokens.emplace_back(token, type); + tokens.push_back (std::pair (token, type)); // Parse for syntax checking and operator replacement. if (_debug) @@ -149,7 +149,7 @@ void Eval::evaluatePostfixExpression (const std::string& e, Variant& v) const std::string token; Lexer::Type type; while (l.token (token, type)) - tokens.emplace_back(token, type); + tokens.push_back (std::pair (token, type)); if (_debug) Context::getContext ().debug ("FILTER Postfix " + dump (tokens)); diff --git a/src/Filter.cpp b/src/Filter.cpp index 1bc606196..88089ee8d 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -64,7 +64,7 @@ void Filter::subset (const std::vector & input, std::vector & output std::vector > precompiled; for (auto& a : Context::getContext ().cli2._args) if (a.hasTag ("FILTER")) - precompiled.emplace_back(a.getToken (), a._lextype); + precompiled.push_back (std::pair (a.getToken (), a._lextype)); if (!precompiled.empty()) { @@ -107,7 +107,7 @@ void Filter::subset (std::vector & output) std::vector > precompiled; for (auto& a : Context::getContext ().cli2._args) if (a.hasTag ("FILTER")) - precompiled.emplace_back(a.getToken (), a._lextype); + precompiled.push_back (std::pair (a.getToken (), a._lextype)); // Shortcut indicates that only pending.data needs to be loaded. bool shortcut = false; diff --git a/src/Hooks.cpp b/src/Hooks.cpp index 05eba2e14..0cbe0650e 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -533,7 +533,7 @@ std::vector & Hooks::buildHookScriptArgs (std::vector Variant v; // Hooks API version. - args.emplace_back("api:2"); + args.push_back ("api:2"); // Command line Taskwarrior was called with. getDOM ("context.args", v); diff --git a/src/ViewTask.cpp b/src/ViewTask.cpp index 7949fe5a8..488a467f1 100644 --- a/src/ViewTask.cpp +++ b/src/ViewTask.cpp @@ -242,7 +242,7 @@ std::string ViewTask::render (std::vector & data, std::vector & seque std::vector > headers; for (unsigned int c = 0; c < _columns.size (); ++c) { - headers.emplace_back(); + headers.push_back (std::vector ()); _columns[c]->renderHeader (headers[c], widths[c], _sort[c] ? _sort_header : _header); if (headers[c].size () > max_lines) @@ -312,7 +312,7 @@ std::string ViewTask::render (std::vector & data, std::vector & seque for (unsigned int c = 0; c < _columns.size (); ++c) { - cells.emplace_back(); + cells.push_back (std::vector ()); _columns[c]->render (cells[c], data[sequence[s]], widths[c], row_color); if (cells[c].size () > max_lines) diff --git a/src/sort.cpp b/src/sort.cpp index 7a7e7eafb..6cba01291 100644 --- a/src/sort.cpp +++ b/src/sort.cpp @@ -79,7 +79,7 @@ void sort_projects ( // if parent does not exist yet: insert into sorted view if (parent_pos == sorted.end ()) - sorted.emplace_back (parent, 1); + sorted.push_back (std::make_pair (parent, 1)); } // insert new element below latest parent @@ -88,7 +88,7 @@ void sort_projects ( else { // if has no parents: simply push to end of list - sorted.emplace_back(project); + sorted.push_back (project); } } }