Fixed #9571 (False positive: containerSize)
This commit is contained in:
parent
3675f49a53
commit
3ec03b8915
|
@ -5772,7 +5772,7 @@ static void valueFlowContainerSize(TokenList *tokenlist, SymbolDatabase* symbold
|
|||
{
|
||||
// declaration
|
||||
for (const Variable *var : symboldatabase->variableList()) {
|
||||
if (!var || !var->isLocal() || var->isPointer() || var->isReference())
|
||||
if (!var || !var->isLocal() || var->isPointer() || var->isReference() || var->isStatic())
|
||||
continue;
|
||||
if (!var->valueType() || !var->valueType()->container)
|
||||
continue;
|
||||
|
|
|
@ -4053,6 +4053,13 @@ private:
|
|||
"}";
|
||||
ASSERT_EQUALS("", isImpossibleContainerSizeValue(tokenValues(code, "s ["), 5));
|
||||
|
||||
code = "void f() {\n"
|
||||
" static std::string s;\n"
|
||||
" if (s.size() == 0)\n"
|
||||
" s = x;\n"
|
||||
"}";
|
||||
ASSERT(tokenValues(code, "s . size").empty());
|
||||
|
||||
// valueFlowContainerForward, loop
|
||||
code = "void f() {\n"
|
||||
" std::stack<Token *> links;\n"
|
||||
|
|
Loading…
Reference in New Issue