From 171bb1839f9288a3a28d1486db70e83fc12951eb Mon Sep 17 00:00:00 2001 From: firewave Date: Mon, 3 Nov 2025 13:06:45 +0100 Subject: [PATCH] fixed some `Variable copied when it could be moved` Coverity warnings --- lib/analyzerinfo.cpp | 2 +- lib/checkother.cpp | 2 +- lib/platform.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/analyzerinfo.cpp b/lib/analyzerinfo.cpp index 809f12567bb..54dbb4496af 100644 --- a/lib/analyzerinfo.cpp +++ b/lib/analyzerinfo.cpp @@ -142,7 +142,7 @@ std::string AnalyzerInformation::getAnalyzerInfoFile(const std::string &buildDir filename = sourcefile; else filename = sourcefile.substr(pos + 1); - return Path::join(buildDir, filename) + ".analyzerinfo"; + return Path::join(buildDir, std::move(filename)) + ".analyzerinfo"; } bool AnalyzerInformation::analyzeFile(const std::string &buildDir, const std::string &sourcefile, const std::string &cfg, int fileIndex, std::size_t hash, std::list &errors) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 7542e7d7b3a..90a487dc9b0 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -4442,7 +4442,7 @@ static std::vector parseUnions(const SymbolDatabase &symbolDatabase, for (const Variable &var : scope.varlist) { u.members.push_back(parseUnionMember(var, settings)); } - unions.push_back(u); + unions.push_back(std::move(u)); } return unions; diff --git a/lib/platform.cpp b/lib/platform.cpp index 1096d056b1e..6a016254589 100644 --- a/lib/platform.cpp +++ b/lib/platform.cpp @@ -180,7 +180,7 @@ bool Platform::loadFromFile(const std::vector& paths, const std::st std::vector filenames; if (is_abs_path) { - filenames.push_back(fullfilename); + filenames.push_back(std::move(fullfilename)); } else { // TODO: drop duplicated paths