3434#include < vector>
3535
3636
37+ static std::string getSummaryFile (std::string analyzerInfoFile)
38+ {
39+ const std::string::size_type pos = analyzerInfoFile.rfind (" .a" );
40+ if (pos == std::string::npos)
41+ return " " ;
42+ analyzerInfoFile[pos+1 ] = ' s' ;
43+ return analyzerInfoFile;
44+ }
3745
3846std::string Summaries::create (const Tokenizer &tokenizer, const std::string &cfg, std::size_t fsFileId)
3947{
@@ -83,10 +91,8 @@ std::string Summaries::create(const Tokenizer &tokenizer, const std::string &cfg
8391 }
8492
8593 if (!settings.buildDir .empty ()) {
86- std::string filename = AnalyzerInformation::getAnalyzerInfoFile (settings.buildDir , Path::simplifyPath (tokenizer.list .getSourceFilePath ()), cfg, fsFileId);
87- const std::string::size_type pos = filename.rfind (" .a" );
88- if (pos != std::string::npos) {
89- filename[pos+1 ] = ' s' ;
94+ const std::string filename = getSummaryFile (AnalyzerInformation::getAnalyzerInfoFile (settings.buildDir , Path::simplifyPath (tokenizer.list .getSourceFilePath ()), cfg, fsFileId));
95+ if (!filename.empty ()) {
9096 std::ofstream fout (filename);
9197 fout << ostr.str ();
9298 }
@@ -106,13 +112,12 @@ static std::vector<std::string> getSummaryFiles(const std::string &filename)
106112 return ret;
107113 std::string line;
108114 while (std::getline (fin, line)) {
109- const std::string::size_type dotA = line.find (" .a" );
110- const std::string::size_type colon = line.find (' :' );
111- if (colon > line.size () || dotA > colon)
115+ AnalyzerInformation::Info filesTxtInfo;
116+ if (!filesTxtInfo.parse (line))
112117 continue ;
113- std::string f = line. substr ( 0 ,colon );
114- f[dotA + 1 ] = ' s ' ;
115- ret.push_back (std::move (f));
118+ std::string f = getSummaryFile (filesTxtInfo. afile );
119+ if (!f. empty ())
120+ ret.push_back (std::move (f));
116121 }
117122 return ret;
118123}
0 commit comments