@@ -65,9 +65,11 @@ static void addFilesToList(const std::string& fileList, std::vector<std::string>
6565 }
6666 if (files && *files) {
6767 std::string fileName;
68+ // cppcheck-suppress accessMoved - FP
6869 while (std::getline (*files, fileName)) { // next line
70+ // cppcheck-suppress accessMoved - FP
6971 if (!fileName.empty ()) {
70- pathNames.emplace_back (fileName);
72+ pathNames.emplace_back (std::move ( fileName) );
7173 }
7274 }
7375 }
@@ -78,6 +80,7 @@ static bool addIncludePathsToList(const std::string& fileList, std::list<std::st
7880 std::ifstream files (fileList);
7981 if (files) {
8082 std::string pathName;
83+ // cppcheck-suppress accessMoved - FP
8184 while (std::getline (files, pathName)) { // next line
8285 if (!pathName.empty ()) {
8386 pathName = Path::removeQuotationMarks (pathName);
@@ -87,7 +90,7 @@ static bool addIncludePathsToList(const std::string& fileList, std::list<std::st
8790 if (!endsWith (pathName, ' /' ))
8891 pathName += ' /' ;
8992
90- pathNames->emplace_back (pathName);
93+ pathNames->emplace_back (std::move ( pathName) );
9194 }
9295 }
9396 return true ;
@@ -200,7 +203,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
200203 if (!endsWith (path,' /' ))
201204 path += ' /' ;
202205
203- mSettings ->includePaths .emplace_back (path);
206+ mSettings ->includePaths .emplace_back (std::move ( path) );
204207 }
205208
206209 // User undef
@@ -423,7 +426,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
423426 if (!endsWith (path, ' /' ))
424427 path += ' /' ;
425428 }
426- mIgnoredPaths .emplace_back (path);
429+ mIgnoredPaths .emplace_back (std::move ( path) );
427430 }
428431 }
429432
@@ -722,7 +725,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
722725 else if (std::strncmp (argv[i], " --rule=" , 7 ) == 0 ) {
723726 Settings::Rule rule;
724727 rule.pattern = 7 + argv[i];
725- mSettings ->rules .emplace_back (rule);
728+ mSettings ->rules .emplace_back (std::move ( rule) );
726729 }
727730
728731 // Rule file
@@ -760,7 +763,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
760763 }
761764
762765 if (!rule.pattern .empty ())
763- mSettings ->rules .emplace_back (rule);
766+ mSettings ->rules .emplace_back (std::move ( rule) );
764767 }
765768 } else {
766769 printError (" unable to load rule-file: " + std::string (12 +argv[i]));
0 commit comments