From cb78d2202f98b720d5e1ee601e48aacdecad275f Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 10 Jun 2025 09:57:10 -0700 Subject: [PATCH] Fix clang-tidy modernize-use-emplace warnings in headers --- src/EventTrace.h | 2 +- src/Reporter.h | 6 ++---- src/script_opt/ZAM/OPs/indexing.op | 2 +- src/script_opt/ZAM/OPs/unary-exprs.op | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/EventTrace.h b/src/EventTrace.h index eb3bd17cd8..2e70c6d244 100644 --- a/src/EventTrace.h +++ b/src/EventTrace.h @@ -292,7 +292,7 @@ public: // Adds to the trace an update for the given value. void AddDelta(ValPtr val, std::string rhs, bool needs_lhs, bool is_first_def) { auto& d = is_post ? post_deltas : deltas; - d.emplace_back(DeltaGen(val, rhs, needs_lhs, is_first_def)); + d.emplace_back(val, rhs, needs_lhs, is_first_def); } // Initially we analyze events pre-execution. When this flag diff --git a/src/Reporter.h b/src/Reporter.h index ff218cb2c9..ce4fcae7d3 100644 --- a/src/Reporter.h +++ b/src/Reporter.h @@ -165,12 +165,10 @@ public: // stack of location so that the most recent is always the one that // will be assumed to be the current one. The pointer must remain // valid until the location is popped. - void PushLocation(const detail::Location* location) { - locations.push_back(std::pair(location, 0)); - } + void PushLocation(const detail::Location* location) { locations.emplace_back(location, nullptr); } void PushLocation(const detail::Location* loc1, const detail::Location* loc2) { - locations.push_back(std::pair(loc1, loc2)); + locations.emplace_back(loc1, loc2); } // Removes the top-most location information from stack. diff --git a/src/script_opt/ZAM/OPs/indexing.op b/src/script_opt/ZAM/OPs/indexing.op index 85f3691150..2a436c7584 100644 --- a/src/script_opt/ZAM/OPs/indexing.op +++ b/src/script_opt/ZAM/OPs/indexing.op @@ -88,7 +88,7 @@ eval EvalIndexAnyVec($$, $1, $2) macro WhenIndexResCheck(vec) if ( vec && IndexExprWhen::evaluating > 0 ) - IndexExprWhen::results.push_back({NewRef{}, vec}); + IndexExprWhen::results.emplace_back(NewRef{}, vec); internal-op When-Index-Vec class VVV diff --git a/src/script_opt/ZAM/OPs/unary-exprs.op b/src/script_opt/ZAM/OPs/unary-exprs.op index 09d8f9d736..a9a1abf57a 100644 --- a/src/script_opt/ZAM/OPs/unary-exprs.op +++ b/src/script_opt/ZAM/OPs/unary-exprs.op @@ -95,7 +95,7 @@ eval auto vv = $1.AsVector(); vv->Assign(0, $2.ToVal(Z_TYPE)); else { - vv->RawVec().push_back(CopyVal($2)); + vv->RawVec().emplace_back(CopyVal($2)); vv->Modified(); }