CheckAssert: Fixed shadow variable warning
This commit is contained in:
parent
56e4487e26
commit
455b07a641
|
@ -116,7 +116,7 @@ void CheckAssert::assignmentInAssertError(const Token *tok, const std::string& v
|
||||||
}
|
}
|
||||||
|
|
||||||
// checks if side effects happen on the variable prior to tmp
|
// checks if side effects happen on the variable prior to tmp
|
||||||
bool CheckAssert::checkVariableAssignment(const Token* assignTok, bool reportError /*= true*/)
|
bool CheckAssert::checkVariableAssignment(const Token* assignTok, bool reportErr /*= true*/)
|
||||||
{
|
{
|
||||||
const Variable* v = assignTok->previous()->variable();
|
const Variable* v = assignTok->previous()->variable();
|
||||||
if (!v) return false;
|
if (!v) return false;
|
||||||
|
@ -126,7 +126,7 @@ bool CheckAssert::checkVariableAssignment(const Token* assignTok, bool reportErr
|
||||||
|
|
||||||
if (v->isConst()) return false;
|
if (v->isConst()) return false;
|
||||||
|
|
||||||
if (reportError) // report as variable assignment error
|
if (reportErr) // report as variable assignment error
|
||||||
assignmentInAssertError(assignTok, v->name());
|
assignmentInAssertError(assignTok, v->name());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
void assertWithSideEffects();
|
void assertWithSideEffects();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool checkVariableAssignment(const Token* tmp, bool reportError = true);
|
bool checkVariableAssignment(const Token* tmp, bool reportErr = true);
|
||||||
bool inSameScope(const Token* returnTok, const Token* assignTok);
|
bool inSameScope(const Token* returnTok, const Token* assignTok);
|
||||||
|
|
||||||
static const Token* findAssertPattern(const Token *start);
|
static const Token* findAssertPattern(const Token *start);
|
||||||
|
@ -73,4 +73,4 @@ private:
|
||||||
};
|
};
|
||||||
/// @}
|
/// @}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue