2424#include " utils.h"
2525
2626#include < array>
27- #include < cstdlib>
2827#include < cstring>
2928#include < exception>
3029#include < iostream>
3130#include < map>
32- #include < set>
3331#include < sstream>
3432#include < stdexcept>
3533#include < utility>
@@ -53,48 +51,18 @@ static std::string getFilename(const std::string &fullpath)
5351 return fullpath.substr (pos1,pos2);
5452}
5553
56- void AnalyzerInformation::writeFilesTxt (const std::string &buildDir, const std::list<std::string> &sourcefiles, const std::list<FileSettings> &fileSettings, bool merge )
54+ void AnalyzerInformation::writeFilesTxt (const std::string &buildDir, const std::list<std::string> &sourcefiles, const std::list<FileSettings> &fileSettings)
5755{
5856 const std::string filesTxt (buildDir + " /files.txt" );
59-
60- std::string keptLines;
61- std::map<std::string, unsigned int > fileCount;
62-
63- if (merge) {
64- std::set<std::string> current;
65- for (const std::string &f : sourcefiles)
66- current.insert (Path::simplifyPath (f));
67- for (const FileSettings &fs : fileSettings)
68- current.insert (Path::simplifyPath (fs.filename ()));
69-
70- std::ifstream fin (filesTxt);
71- std::string line;
72- while (std::getline (fin, line)) {
73- Info info;
74- if (!info.parse (line))
75- continue ;
76- if (current.count (info.sourceFile ))
77- continue ;
78- keptLines += line + ' \n ' ;
79-
80- const std::string::size_type dotA = info.afile .rfind (" .a" );
81- if (dotA != std::string::npos) {
82- const std::string base = info.afile .substr (0 , dotA);
83- const unsigned int n = std::strtoul (info.afile .c_str () + dotA + 2 , nullptr , 10 );
84- unsigned int &count = fileCount[base];
85- count = std::max (count, n);
86- }
87- }
88- }
89-
9057 std::ofstream fout (filesTxt);
91- fout << keptLines;
92- fout << getFilesTxt (sourcefiles, fileSettings, fileCount);
58+ fout << getFilesTxt (sourcefiles, fileSettings);
9359}
9460
95- std::string AnalyzerInformation::getFilesTxt (const std::list<std::string> &sourcefiles, const std::list<FileSettings> &fileSettings, std::map<std::string, unsigned int > fileCount ) {
61+ std::string AnalyzerInformation::getFilesTxt (const std::list<std::string> &sourcefiles, const std::list<FileSettings> &fileSettings) {
9662 std::ostringstream ret;
9763
64+ std::map<std::string, unsigned int > fileCount;
65+
9866 for (const std::string &f : sourcefiles) {
9967 const std::string afile = getFilename (f);
10068 ret << afile << " .a" << (++fileCount[afile]) << sep << sep << sep << Path::simplifyPath (f) << ' \n ' ;
0 commit comments