This commit is contained in:
Paul 2020-09-06 21:59:21 -05:00
parent c7a5d3c5f1
commit 786672e19d
3 changed files with 5 additions and 4 deletions

View File

@ -484,7 +484,7 @@ static bool isDanglingSubFunction(const Token* tokvalue, const Token* tok)
if (!f)
return false;
const Token* parent = tokvalue->astParent();
while(parent && !Token::Match(parent->previous(), "%name% (")) {
while (parent && !Token::Match(parent->previous(), "%name% (")) {
parent = parent->astParent();
}
if (!Token::simpleMatch(parent, "("))

View File

@ -1040,8 +1040,9 @@ public:
return false;
}
static Function* nestedInFunction(const Scope* scope) {
while(scope) {
static Function* nestedInFunction(const Scope* scope)
{
while (scope) {
if (scope->type == Scope::eFunction)
break;
scope = scope->nestedIn;

View File

@ -2170,7 +2170,7 @@ private:
ASSERT_EQUALS(
"[test.cpp:8] -> [test.cpp:8] -> [test.cpp:4] -> [test.cpp:7] -> [test.cpp:4]: (error) Non-local variable 'v' will use object that points to local variable 'i'.\n",
errout.str());
check("struct A {\n"
" std::vector<int*> v;\n"
" void add(int* i) {\n"