@@ -3570,6 +3570,7 @@ namespace
35703570 struct NameLoc {
35713571 std::string className;
35723572 std::string fileName;
3573+ std::string configuration;
35733574 int lineNumber;
35743575 int column;
35753576 std::size_t hash;
@@ -3589,6 +3590,7 @@ namespace
35893590 for (const NameLoc &nameLoc: classDefinitions) {
35903591 ret += " <class name=\" " + ErrorLogger::toxml (nameLoc.className ) +
35913592 " \" file=\" " + ErrorLogger::toxml (nameLoc.fileName ) +
3593+ " \" configuration=\" " + ErrorLogger::toxml (nameLoc.configuration ) +
35923594 " \" line=\" " + std::to_string (nameLoc.lineNumber ) +
35933595 " \" col=\" " + std::to_string (nameLoc.column ) +
35943596 " \" hash=\" " + std::to_string (nameLoc.hash ) +
@@ -3599,7 +3601,7 @@ namespace
35993601 };
36003602}
36013603
3602- Check::FileInfo *CheckClass::getFileInfo (const Tokenizer &tokenizer, const Settings& /* settings*/ ) const
3604+ Check::FileInfo *CheckClass::getFileInfo (const Tokenizer &tokenizer, const Settings& /* settings*/ , const std::string& currentConfig ) const
36033605{
36043606 if (!tokenizer.isCPP ())
36053607 return nullptr ;
@@ -3656,6 +3658,7 @@ Check::FileInfo *CheckClass::getFileInfo(const Tokenizer &tokenizer, const Setti
36563658 }
36573659 }
36583660 nameLoc.hash = std::hash<std::string> {}(def);
3661+ nameLoc.configuration = currentConfig;
36593662
36603663 classDefinitions.push_back (std::move (nameLoc));
36613664 }
@@ -3676,13 +3679,15 @@ Check::FileInfo * CheckClass::loadFileInfoFromXml(const tinyxml2::XMLElement *xm
36763679 continue ;
36773680 const char *name = e->Attribute (" name" );
36783681 const char *file = e->Attribute (" file" );
3682+ const char *configuration = e->Attribute (" configuration" );
36793683 const char *line = e->Attribute (" line" );
36803684 const char *col = e->Attribute (" col" );
36813685 const char *hash = e->Attribute (" hash" );
3682- if (name && file && line && col && hash) {
3686+ if (name && file && configuration && line && col && hash) {
36833687 MyFileInfo::NameLoc nameLoc;
36843688 nameLoc.className = name;
36853689 nameLoc.fileName = file;
3690+ nameLoc.configuration = configuration;
36863691 nameLoc.lineNumber = strToInt<int >(line);
36873692 nameLoc.column = strToInt<int >(col);
36883693 nameLoc.hash = strToInt<std::size_t >(hash);
@@ -3724,6 +3729,8 @@ bool CheckClass::analyseWholeProgram(const CTU::FileInfo &ctu, const std::list<C
37243729 }
37253730 if (it->second .hash == nameLoc.hash )
37263731 continue ;
3732+ if (it->second .fileName == nameLoc.fileName && it->second .configuration != nameLoc.configuration )
3733+ continue ;
37273734 // Same location, sometimes the hash is different wrongly (possibly because of different token simplifications).
37283735 if (it->second .isSameLocation (nameLoc))
37293736 continue ;
0 commit comments