Fix issue 9907: False positive: knownEmptyContainer after function call with :: (#2814)
This commit is contained in:
parent
730b95331e
commit
7b6d3f8061
|
@ -1388,6 +1388,11 @@ const Token * getTokenArgumentFunction(const Token * tok, int& argn)
|
|||
while (Token::simpleMatch(tok, "."))
|
||||
tok = tok->astOperand2();
|
||||
while (Token::simpleMatch(tok, "::")) {
|
||||
// If there is only a op1 and not op2, then this is a global scope
|
||||
if (!tok->astOperand2() && tok->astOperand1()) {
|
||||
tok = tok->astOperand1();
|
||||
break;
|
||||
}
|
||||
tok = tok->astOperand2();
|
||||
if (Token::simpleMatch(tok, "<") && tok->link())
|
||||
tok = tok->astOperand1();
|
||||
|
|
|
@ -4713,6 +4713,20 @@ private:
|
|||
"}\n",
|
||||
true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("static void f1(std::list<std::string>& parameters) {\n"
|
||||
" parameters.push_back(a);\n"
|
||||
"}\n"
|
||||
"int f2(std::list<std::string>& parameters) {\n"
|
||||
" f1(parameters);\n"
|
||||
"}\n"
|
||||
"void f3() {\n"
|
||||
" std::list<std::string> parameters;\n"
|
||||
" int res = ::f2(parameters);\n"
|
||||
" for (auto param : parameters) {}\n"
|
||||
"}\n",
|
||||
true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void checkMutexes() {
|
||||
|
|
Loading…
Reference in New Issue