value flow: fixed fp when self-checking checkbool.cpp. added some comments.
This commit is contained in:
parent
b1bbb23225
commit
bfc67a536a
|
@ -759,9 +759,10 @@ void CheckNullPointer::nullPointerByDeRefAndChec()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const Variable *var = tok->variable();
|
const Variable *var = tok->variable();
|
||||||
if (!var || !var->isPointer())
|
if (!var || !var->isPointer() || tok == var->nameToken())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Can pointer be NULL?
|
||||||
const ValueFlow::Value *value = 0;
|
const ValueFlow::Value *value = 0;
|
||||||
for (std::list<ValueFlow::Value>::const_iterator it = tok->values.begin(); it != tok->values.end(); ++it) {
|
for (std::list<ValueFlow::Value>::const_iterator it = tok->values.begin(); it != tok->values.end(); ++it) {
|
||||||
if (it->intvalue == 0) {
|
if (it->intvalue == 0) {
|
||||||
|
@ -772,6 +773,7 @@ void CheckNullPointer::nullPointerByDeRefAndChec()
|
||||||
if (!value)
|
if (!value)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Is pointer used as function parameter?
|
||||||
if (Token::Match(tok->previous(), "[(,] %var% [,)]")) {
|
if (Token::Match(tok->previous(), "[(,] %var% [,)]")) {
|
||||||
const Token *ftok = tok->previous();
|
const Token *ftok = tok->previous();
|
||||||
while (ftok && ftok->str() != "(") {
|
while (ftok && ftok->str() != "(") {
|
||||||
|
@ -792,6 +794,7 @@ void CheckNullPointer::nullPointerByDeRefAndChec()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pointer dereference.
|
||||||
bool unknown = false;
|
bool unknown = false;
|
||||||
if (!isPointerDeRef(tok,unknown))
|
if (!isPointerDeRef(tok,unknown))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue