diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-25 14:26:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-25 14:26:08 +0300 |
commit | c5a2862674d022b1f45ef74da79570620095805c (patch) | |
tree | c3dbc9e0c4d547223876f1987d25e67ebab24111 | |
parent | 06b55fde7a240a86cab66d9c0b756aac9b00f96a (diff) | |
download | paranucker-c5a2862674d022b1f45ef74da79570620095805c.tar.gz paranucker-c5a2862674d022b1f45ef74da79570620095805c.tar.bz2 paranucker-c5a2862674d022b1f45ef74da79570620095805c.tar.xz paranucker-c5a2862674d022b1f45ef74da79570620095805c.zip |
Improve detecting null pointers in COMPONENT_REF.
-rw-r--r-- | src/analysis/analysis.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/analysis/analysis.cpp b/src/analysis/analysis.cpp index 2be2381..024abc4 100644 --- a/src/analysis/analysis.cpp +++ b/src/analysis/analysis.cpp @@ -217,24 +217,27 @@ void reportParmDeclNullPointer(Node *mainNode, const WalkItem &wi) { node = skipNop(node); - if (node && !node->label.empty()) + if (node) { - if (node->nodeType == PARM_DECL) + if (!node->label.empty()) { - if (wi.checkNullVars.find(node->label) != wi.checkNullVars.end()) + if (node->nodeType == PARM_DECL) { - Log::warn(findBackLocation(mainNode), - "Using parameter '%s' without checking for null pointer", - node->label); + if (wi.checkNullVars.find(node->label) != wi.checkNullVars.end()) + { + Log::warn(findBackLocation(mainNode), + "Using parameter '%s' without checking for null pointer", + node->label); + } } - } - else if (node->nodeType == VAR_DECL) - { - if (wi.checkNullVars.find(node->label) != wi.checkNullVars.end()) + else if (node->nodeType == VAR_DECL) { - Log::warn(findBackLocation(mainNode), - "Using variable '%s' without checking for null pointer", - node->label); + if (wi.checkNullVars.find(node->label) != wi.checkNullVars.end()) + { + Log::warn(findBackLocation(mainNode), + "Using variable '%s' without checking for null pointer", + node->label); + } } } else if (node->nodeType == COMPONENT_REF) |