@@ -137,16 +137,21 @@ ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const Token
137137
138138 setmsg (msg);
139139
140- hash = calculateWarningHash (list, toString (false ));
140+ std::ostringstream hashWarning;
141+ for (const Token *tok: callstack)
142+ hashWarning << std::hex << (tok ? tok->index () : 0 ) << " " ;
143+ hashWarning << mShortMessage ;
144+
145+ hash = calculateWarningHash (list, hashWarning.str ());
141146}
142147
143148ErrorMessage::ErrorMessage (const ErrorPath &errorPath, const TokenList *tokenList, Severity::SeverityType severity, const char id[], const std::string &msg, const CWE &cwe, bool inconclusive)
144149 : id(id), incomplete(false ), severity(severity), cwe(cwe.id), inconclusive(inconclusive)
145150{
146151 // Format callstack
147- for (ErrorPath::const_iterator it = errorPath. begin (); it != errorPath. end (); ++it ) {
148- const Token *tok = it-> first ;
149- const std::string &info = it-> second ;
152+ for (const ErrorPathItem& e: errorPath) {
153+ const Token *tok = e. first ;
154+ const std::string &info = e. second ;
150155
151156 // --errorlist can provide null values here
152157 if (tok)
@@ -158,7 +163,12 @@ ErrorMessage::ErrorMessage(const ErrorPath &errorPath, const TokenList *tokenLis
158163
159164 setmsg (msg);
160165
161- hash = calculateWarningHash (tokenList, toString (false ));
166+ std::ostringstream hashWarning;
167+ for (const ErrorPathItem &e: errorPath)
168+ hashWarning << std::hex << (tok ? tok->index () : 0 ) << " " ;
169+ hashWarning << mShortMessage ;
170+
171+ hash = calculateWarningHash (tokenList, hashWarning.str ());
162172}
163173
164174ErrorMessage::ErrorMessage (const tinyxml2::XMLElement * const errmsg)
0 commit comments