Fixed false positive autovarInvalidDeallocation if deallocting result of member function (#6551)
This commit is contained in:
parent
630ba1086c
commit
a8cf63239a
|
@ -76,6 +76,13 @@ bool CheckAutoVariables::isAutoVar(const Token *tok)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Token::Match(tok, "%name% .|::")) {
|
||||
do {
|
||||
tok = tok->tokAt(2);
|
||||
} while (Token::Match(tok, "%name% .|::"));
|
||||
if (Token::Match(tok, "%name% ("))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -592,6 +592,13 @@ private:
|
|||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #6551
|
||||
check("bool foo( ) {\n"
|
||||
" SwTxtFld * pTxtFld = GetFldTxtAttrAt();\n"
|
||||
" delete static_cast<SwFmtFld*>(&pTxtFld->GetAttr());\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void testinvaliddealloc_C() {
|
||||
|
|
Loading…
Reference in New Issue