Visual Studio: Fixed unittests
This commit is contained in:
parent
8cb4df30ea
commit
cd2e501794
|
@ -305,9 +305,11 @@ void CheckMemoryLeak::reportErr(const std::list<const Token *> &callstack, Sever
|
||||||
|
|
||||||
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it)
|
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it)
|
||||||
{
|
{
|
||||||
|
const Token * const tok = *it;
|
||||||
|
|
||||||
ErrorLogger::ErrorMessage::FileLocation loc;
|
ErrorLogger::ErrorMessage::FileLocation loc;
|
||||||
loc.line = (*it)->linenr();
|
loc.line = tok->linenr();
|
||||||
loc.file = tokenizer->file(*it);
|
loc.file = tokenizer->file(tok);
|
||||||
|
|
||||||
locations.push_back(loc);
|
locations.push_back(loc);
|
||||||
}
|
}
|
||||||
|
@ -2593,9 +2595,13 @@ private:
|
||||||
CheckLocalLeaks *C = dynamic_cast<CheckLocalLeaks *>(*it);
|
CheckLocalLeaks *C = dynamic_cast<CheckLocalLeaks *>(*it);
|
||||||
if (C && C->allocated)
|
if (C && C->allocated)
|
||||||
{
|
{
|
||||||
CheckMemoryLeak *checkMemleak = dynamic_cast<CheckMemoryLeak *>(C->owner);
|
CheckMemoryLeakInFunction *checkMemleak = static_cast<CheckMemoryLeakInFunction *>(C->owner);
|
||||||
|
if (checkMemleak)
|
||||||
|
{
|
||||||
checkMemleak->memleakError(tok, C->varname, false);
|
checkMemleak->memleakError(tok, C->varname, false);
|
||||||
foundError = true;
|
foundError = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ public:
|
||||||
* -# finally, check if the simplified token list contain any leaks.
|
* -# finally, check if the simplified token list contain any leaks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CheckMemoryLeakInFunction : private Check, private CheckMemoryLeak
|
class CheckMemoryLeakInFunction : private Check, public CheckMemoryLeak
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** This constructor is used when registering this class */
|
/** This constructor is used when registering this class */
|
||||||
|
|
Loading…
Reference in New Issue