Fix some recent Coverity findings

This commit is contained in:
Tim Wojtulewicz 2025-09-30 15:57:17 -07:00
parent 8b4707a284
commit 66f9695927
4 changed files with 4 additions and 4 deletions

View file

@ -574,7 +574,7 @@ void ScriptFunc::ReplaceBody(const StmtPtr& old_body, StmtPtr new_body) {
if ( new_body )
body->stmts = new_body;
else
bodies.erase(body);
body = bodies.erase(body);
found_it = true;
current_body = *body;

View file

@ -265,7 +265,7 @@ public:
*/
void ReplaceBody(const detail::StmtPtr& old_body, detail::StmtPtr new_body);
auto CurrentBody() const { return current_body; }
const Body& CurrentBody() const { return current_body; }
/**
* Returns the function's frame size.

View file

@ -127,7 +127,7 @@ void CPPCompile::CreateFunction(const FuncTypePtr& ft, const ProfileFunc* pf, co
body_info[fname] = {.hash = pf->HashVal(),
.priority = priority,
.loc = body->GetLocationInfo(),
.module = module_group,
.module = std::move(module_group),
.groups = std::move(attr_groups)};
body_names.emplace(body.get(), fname);
}

View file

@ -880,7 +880,7 @@ void ProfileFuncs::AnalyzeLambdaProfile(const LambdaExpr* l) {
lambda_primaries[l->Name()] = l->PrimaryFunc().get();
if ( compute_func_hashes || ! pf->HasHashVal() )
ComputeProfileHash(pf);
ComputeProfileHash(std::move(pf));
}
void ProfileFuncs::ComputeProfileHash(std::shared_ptr<ProfileFunc> pf) {