@@ -522,7 +522,7 @@ unsigned int CppCheck::check(const std::string &path)
522522 }
523523
524524 // run addons
525- executeAddons (dumpFile);
525+ executeAddons (dumpFile, path );
526526
527527 } catch (const InternalError &e) {
528528 const ErrorMessage errmsg = ErrorMessage::fromInternalError (e, nullptr , path, " Bailing out from analysis: Processing Clang AST dump failed" );
@@ -967,7 +967,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
967967 fdump.close ();
968968 }
969969
970- executeAddons (dumpFile);
970+ executeAddons (dumpFile, Path::simplifyPath (filename) );
971971
972972 } catch (const TerminateException &) {
973973 // Analysis is terminated
@@ -1371,15 +1371,15 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
13711371}
13721372#endif
13731373
1374- void CppCheck::executeAddons (const std::string& dumpFile)
1374+ void CppCheck::executeAddons (const std::string& dumpFile, const std::string& file0 )
13751375{
13761376 if (!dumpFile.empty ()) {
13771377 std::vector<std::string> f{dumpFile};
1378- executeAddons (f);
1378+ executeAddons (f, file0 );
13791379 }
13801380}
13811381
1382- void CppCheck::executeAddons (const std::vector<std::string>& files)
1382+ void CppCheck::executeAddons (const std::vector<std::string>& files, const std::string& file0 )
13831383{
13841384 if (mSettings .addons .empty () || files.empty ())
13851385 return ;
@@ -1444,7 +1444,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files)
14441444 }
14451445 else if (!mSettings .severity .isEnabled (errmsg.severity ))
14461446 continue ;
1447- errmsg.file0 = ((files. size () == 1 ) ? files[ 0 ] : " " ) ;
1447+ errmsg.file0 = file0 ;
14481448
14491449 reportErr (errmsg);
14501450 }
@@ -1463,7 +1463,7 @@ void CppCheck::executeAddonsWholeProgram(const std::map<std::string, std::size_t
14631463 }
14641464
14651465 try {
1466- executeAddons (ctuInfoFiles);
1466+ executeAddons (ctuInfoFiles, " " );
14671467 } catch (const InternalError& e) {
14681468 const ErrorMessage errmsg = ErrorMessage::fromInternalError (e, nullptr , " " , " Bailing out from analysis: Whole program analysis failed" );
14691469 reportErr (errmsg);
0 commit comments