@@ -330,16 +330,16 @@ static std::vector<std::string> split(const std::string &str, const std::string
330330 return ret;
331331}
332332
333- static std::string getDumpFileName (const Settings& settings, const std::string& filename, int fileIndex )
333+ static std::string getDumpFileName (const Settings& settings, const std::string& filename, int fsFileId )
334334{
335335 std::string extension = " .dump" ;
336- if (fileIndex > 0 )
337- extension = " ." + std::to_string (fileIndex ) + extension;
336+ if (fsFileId > 0 )
337+ extension = " ." + std::to_string (fsFileId ) + extension;
338338 if (!settings.dump && settings.buildDir .empty ())
339339 extension = " ." + std::to_string (settings.pid ) + extension;
340340
341341 if (!settings.dump && !settings.buildDir .empty ())
342- return AnalyzerInformation::getAnalyzerInfoFile (settings.buildDir , filename, " " , fileIndex ) + extension;
342+ return AnalyzerInformation::getAnalyzerInfoFile (settings.buildDir , filename, " " , fsFileId ) + extension;
343343 return filename + extension;
344344}
345345
@@ -350,13 +350,13 @@ static std::string getCtuInfoFileName(const std::string &dumpFile)
350350
351351static void createDumpFile (const Settings& settings,
352352 const FileWithDetails& file,
353- int fileIndex ,
353+ int fsFileId ,
354354 std::ofstream& fdump,
355355 std::string& dumpFile)
356356{
357357 if (!settings.dump && settings.addons .empty ())
358358 return ;
359- dumpFile = getDumpFileName (settings, file.spath (), fileIndex );
359+ dumpFile = getDumpFileName (settings, file.spath (), fsFileId );
360360
361361 fdump.open (dumpFile);
362362 if (!fdump.is_open ())
@@ -660,7 +660,7 @@ static std::string getClangFlags(const Settings& setting, Standards::Language la
660660}
661661
662662// TODO: clear error list before returning
663- unsigned int CppCheck::checkClang (const FileWithDetails &file, int fileIndex )
663+ unsigned int CppCheck::checkClang (const FileWithDetails &file, int fsFileId )
664664{
665665 // TODO: clear exitcode
666666
@@ -673,7 +673,7 @@ unsigned int CppCheck::checkClang(const FileWithDetails &file, int fileIndex)
673673 // TODO: get language from FileWithDetails object
674674 std::string clangStderr;
675675 if (!mSettings .buildDir .empty ())
676- clangStderr = AnalyzerInformation::getAnalyzerInfoFile (mSettings .buildDir , file.spath (), " " , fileIndex ) + " .clang-stderr" ;
676+ clangStderr = AnalyzerInformation::getAnalyzerInfoFile (mSettings .buildDir , file.spath (), " " , fsFileId ) + " .clang-stderr" ;
677677
678678 std::string exe = mSettings .clangExecutable ;
679679#ifdef _WIN32
@@ -747,7 +747,7 @@ unsigned int CppCheck::checkClang(const FileWithDetails &file, int fileIndex)
747747 // create dumpfile
748748 std::ofstream fdump;
749749 std::string dumpFile;
750- createDumpFile (mSettings , file, fileIndex , fdump, dumpFile);
750+ createDumpFile (mSettings , file, fsFileId , fdump, dumpFile);
751751 if (fdump.is_open ()) {
752752 fdump << getLibraryDumpData ();
753753 // TODO: use tinyxml2 to create XML
@@ -838,7 +838,7 @@ unsigned int CppCheck::check(const FileSettings &fs)
838838 }
839839 // need to pass the externally provided ErrorLogger instead of our internal wrapper
840840 CppCheck temp (tempSettings, mSuppressions , mErrorLoggerDirect , mTimerResults , mUseGlobalSuppressions , mExecuteCommand );
841- const unsigned int returnValue = temp.checkFile (fs.file , fs.cfg , fs.fileIndex );
841+ const unsigned int returnValue = temp.checkFile (fs.file , fs.cfg , fs.fsFileId );
842842 if (mUnusedFunctionsCheck )
843843 mUnusedFunctionsCheck ->updateFunctionData (*temp.mUnusedFunctionsCheck );
844844 while (!temp.mFileInfo .empty ()) {
@@ -875,20 +875,20 @@ std::size_t CppCheck::calculateHash(const Preprocessor& preprocessor, const std:
875875 return preprocessor.calculateHash (toolinfo.str ());
876876}
877877
878- unsigned int CppCheck::checkBuffer (const FileWithDetails &file, const std::string &cfgname, int fileIndex , const char * data, std::size_t size)
878+ unsigned int CppCheck::checkBuffer (const FileWithDetails &file, const std::string &cfgname, int fsFileId , const char * data, std::size_t size)
879879{
880880 const auto f = [&file, data, size](std::vector<std::string>& files, simplecpp::OutputList* outputList) {
881881 return simplecpp::TokenList{{data, size}, files, file.spath (), outputList};
882882 };
883- return checkInternal (file, cfgname, fileIndex , f);
883+ return checkInternal (file, cfgname, fsFileId , f);
884884}
885885
886- unsigned int CppCheck::checkFile (const FileWithDetails& file, const std::string &cfgname, int fileIndex )
886+ unsigned int CppCheck::checkFile (const FileWithDetails& file, const std::string &cfgname, int fsFileId )
887887{
888888 const auto f = [&file](std::vector<std::string>& files, simplecpp::OutputList* outputList) {
889889 return simplecpp::TokenList{file.spath (), files, outputList};
890890 };
891- return checkInternal (file, cfgname, fileIndex , f);
891+ return checkInternal (file, cfgname, fsFileId , f);
892892}
893893
894894void CppCheck::checkPlistOutput (const FileWithDetails& file, const std::vector<std::string>& files)
@@ -906,7 +906,7 @@ void CppCheck::checkPlistOutput(const FileWithDetails& file, const std::vector<s
906906 }
907907}
908908
909- unsigned int CppCheck::checkInternal (const FileWithDetails& file, const std::string &cfgname, int fileIndex , const CreateTokenListFn& createTokenList)
909+ unsigned int CppCheck::checkInternal (const FileWithDetails& file, const std::string &cfgname, int fsFileId , const CreateTokenListFn& createTokenList)
910910{
911911 // TODO: move to constructor when CppCheck no longer owns the settings
912912 if (mSettings .checks .isEnabled (Checks::unusedFunction) && !mUnusedFunctionsCheck )
@@ -974,7 +974,7 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
974974 mLogger ->setAnalyzerInfo (nullptr );
975975
976976 std::list<ErrorMessage> errors;
977- analyzerInformation->analyzeFile (mSettings .buildDir , file.spath (), cfgname, fileIndex , hash, errors);
977+ analyzerInformation->analyzeFile (mSettings .buildDir , file.spath (), cfgname, fsFileId , hash, errors);
978978 analyzerInformation->setFileInfo (" CheckUnusedFunctions" , mUnusedFunctionsCheck ->analyzerInfo (tokenizer));
979979 analyzerInformation->close ();
980980 }
@@ -1020,7 +1020,7 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
10201020 // Calculate hash so it can be compared with old hash / future hashes
10211021 const std::size_t hash = calculateHash (preprocessor, file.spath ());
10221022 std::list<ErrorMessage> errors;
1023- if (!analyzerInformation->analyzeFile (mSettings .buildDir , file.spath (), cfgname, fileIndex , hash, errors)) {
1023+ if (!analyzerInformation->analyzeFile (mSettings .buildDir , file.spath (), cfgname, fsFileId , hash, errors)) {
10241024 while (!errors.empty ()) {
10251025 mErrorLogger .reportErr (errors.front ());
10261026 errors.pop_front ();
@@ -1077,7 +1077,7 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
10771077 // write dump file xml prolog
10781078 std::ofstream fdump;
10791079 std::string dumpFile;
1080- createDumpFile (mSettings , file, fileIndex , fdump, dumpFile);
1080+ createDumpFile (mSettings , file, fsFileId , fdump, dumpFile);
10811081 if (fdump.is_open ()) {
10821082 fdump << getLibraryDumpData ();
10831083 fdump << dumpProlog;
@@ -1200,7 +1200,7 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
12001200#endif
12011201
12021202 // Simplify tokens into normal form, skip rest of iteration if failed
1203- if (!tokenizer.simplifyTokens1 (currentConfig, fileIndex ))
1203+ if (!tokenizer.simplifyTokens1 (currentConfig, fsFileId ))
12041204 continue ;
12051205
12061206 // dump xml if --dump
@@ -1636,7 +1636,7 @@ void CppCheck::executeAddonsWholeProgram(const std::list<FileWithDetails> &files
16361636 }
16371637
16381638 for (const auto &f: fileSettings) {
1639- const std::string &dumpFileName = getDumpFileName (mSettings , f.filename (), f.fileIndex );
1639+ const std::string &dumpFileName = getDumpFileName (mSettings , f.filename (), f.fsFileId );
16401640 ctuInfoFiles.push_back (getCtuInfoFileName (dumpFileName));
16411641 }
16421642
@@ -1748,7 +1748,7 @@ void CppCheck::analyseClangTidy(const FileSettings &fileSettings)
17481748 std::string line;
17491749
17501750 if (!mSettings .buildDir .empty ()) {
1751- const std::string analyzerInfoFile = AnalyzerInformation::getAnalyzerInfoFile (mSettings .buildDir , fileSettings.filename (), " " , fileSettings.fileIndex );
1751+ const std::string analyzerInfoFile = AnalyzerInformation::getAnalyzerInfoFile (mSettings .buildDir , fileSettings.filename (), " " , fileSettings.fsFileId );
17521752 std::ofstream fcmd (analyzerInfoFile + " .clang-tidy-cmd" );
17531753 fcmd << istr.str ();
17541754 }
0 commit comments