@@ -433,8 +433,6 @@ static std::vector<picojson::value> executeAddon(const AddonInfo &addonInfo,
433433 const std::string &premiumArgs,
434434 const CppCheck::ExecuteCmdFn &executeCommand)
435435{
436- const std::string redirect = " 2>&1" ;
437-
438436 std::string pythonExe;
439437
440438 if (!addonInfo.executable .empty ())
@@ -463,7 +461,7 @@ static std::vector<picojson::value> executeAddon(const AddonInfo &addonInfo,
463461 args += fileArg;
464462
465463 std::string result;
466- if (const int exitcode = executeCommand (pythonExe, split (args), redirect , result)) {
464+ if (const int exitcode = executeCommand (pythonExe, split (args), " 2>&1 " , result)) {
467465 std::string message (" Failed to execute addon '" + addonInfo.name + " ' - exitcode is " + std::to_string (exitcode));
468466 std::string details = pythonExe + " " + args;
469467 if (result.size () > 2 ) {
@@ -585,17 +583,17 @@ static bool reportClangErrors(std::istream &is, const std::function<void(const E
585583 if (pos1 >= pos2 || pos2 >= pos3)
586584 continue ;
587585
588- const std::string filename = line.substr (0 , pos1);
586+ std::string filename = line.substr (0 , pos1);
589587 const std::string linenr = line.substr (pos1+1 , pos2-pos1-1 );
590588 const std::string colnr = line.substr (pos2+1 , pos3-pos2-1 );
591589 const std::string msg = line.substr (line.find (' :' , pos3+1 ) + 2 );
592590
593- const std::string locFile = Path::toNativeSeparators (filename);
591+ std::string locFile = Path::toNativeSeparators (std::move ( filename) );
594592 const int line_i = strToInt<int >(linenr);
595593 const int column = strToInt<unsigned int >(colnr);
596594 ErrorMessage::FileLocation loc (locFile, line_i, column);
597595 ErrorMessage errmsg ({std::move (loc)},
598- locFile,
596+ std::move ( locFile) ,
599597 Severity::error,
600598 msg,
601599 " syntaxError" ,
@@ -1228,10 +1226,10 @@ unsigned int CppCheck::checkFile(const FileWithDetails& file, const std::string
12281226 for (const std::string &s : configurationError)
12291227 msg += ' \n ' + s;
12301228
1231- const std::string locFile = Path::toNativeSeparators (file.spath ());
1229+ std::string locFile = Path::toNativeSeparators (file.spath ());
12321230 ErrorMessage::FileLocation loc (locFile, 0 , 0 );
12331231 ErrorMessage errmsg ({std::move (loc)},
1234- locFile,
1232+ std::move ( locFile) ,
12351233 Severity::information,
12361234 msg,
12371235 " noValidConfiguration" ,
@@ -1779,13 +1777,13 @@ void CppCheck::executeAddonsWholeProgram(const std::list<FileWithDetails> &files
17791777 return ;
17801778
17811779 if (mSettings .buildDir .empty ()) {
1782- const std::string fileName = std::to_string (mSettings .pid ) + " .ctu-info" ;
1780+ std::string fileName = std::to_string (mSettings .pid ) + " .ctu-info" ;
17831781 FilesDeleter filesDeleter;
17841782 filesDeleter.addFile (fileName);
17851783 std::ofstream fout (fileName);
17861784 fout << ctuInfo;
17871785 fout.close ();
1788- executeAddons ({fileName}, " " );
1786+ executeAddons ({std::move ( fileName) }, " " );
17891787 return ;
17901788 }
17911789
0 commit comments