Skip to content

Commit a8ba17d

Browse files
authored
fixed some Variable copied when it could be moved Coverity warnings (#7742)
1 parent 5b89c84 commit a8ba17d

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/library.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <stdexcept>
4040
#include <string>
4141
#include <unordered_set>
42+
#include <utility>
4243

4344
#include "xml.h"
4445

@@ -241,7 +242,7 @@ Library::Error Library::load(const char exename[], const char path[], bool debug
241242
if (mData->mFiles.find(absolute_path) == mData->mFiles.end()) {
242243
Error err = load(doc);
243244
if (err.errorcode == ErrorCode::OK)
244-
mData->mFiles.insert(absolute_path);
245+
mData->mFiles.insert(std::move(absolute_path));
245246
return err;
246247
}
247248

lib/symboldatabase.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <type_traits>
5252
#include <unordered_map>
5353
#include <unordered_set>
54+
#include <utility>
5455
//---------------------------------------------------------------------------
5556

5657
SymbolDatabase::SymbolDatabase(Tokenizer& tokenizer)
@@ -2212,7 +2213,7 @@ void SymbolDatabase::debugSymbolDatabase() const
22122213
}
22132214
errorPath.emplace_back(tok, "");
22142215
mErrorLogger.reportErr(
2215-
{errorPath, &mTokenizer.list, Severity::debug, "valueType", msg, CWE{0}, Certainty::normal});
2216+
{std::move(errorPath), &mTokenizer.list, Severity::debug, "valueType", msg, CWE{0}, Certainty::normal});
22162217
}
22172218
}
22182219
}

lib/valueflow.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
#include <string>
129129
#include <unordered_map>
130130
#include <unordered_set>
131+
#include <utility>
131132
#include <vector>
132133

133134
static void bailoutInternal(const std::string& type,
@@ -7275,7 +7276,7 @@ static void valueFlowDebug(TokenList& tokenlist, ErrorLogger& errorLogger, const
72757276
ErrorPath errorPath = v.errorPath;
72767277
errorPath.insert(errorPath.end(), v.debugPath.cbegin(), v.debugPath.cend());
72777278
errorPath.emplace_back(tok, "");
7278-
errorLogger.reportErr({errorPath, &tokenlist, Severity::debug, "valueFlow", msg, CWE{0}, Certainty::normal});
7279+
errorLogger.reportErr({std::move(errorPath), &tokenlist, Severity::debug, "valueFlow", msg, CWE{0}, Certainty::normal});
72797280
}
72807281
}
72817282
}

0 commit comments

Comments
 (0)