diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-22 18:54:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-22 18:54:45 +0300 |
commit | dc882ac20b776eaa206f74573eca994be013941c (patch) | |
tree | c8819c37cca75020792d3107fec1774fb1e504bc /src/analysis/expression.cpp | |
parent | cea1bf35ade4362d0a9e46980b1fdba44764ff61 (diff) | |
download | paranucker-dc882ac20b776eaa206f74573eca994be013941c.tar.gz paranucker-dc882ac20b776eaa206f74573eca994be013941c.tar.bz2 paranucker-dc882ac20b776eaa206f74573eca994be013941c.tar.xz paranucker-dc882ac20b776eaa206f74573eca994be013941c.zip |
Fix issue in related variables checks.
Diffstat (limited to 'src/analysis/expression.cpp')
-rw-r--r-- | src/analysis/expression.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/analysis/expression.cpp b/src/analysis/expression.cpp index 34f4998..1ed9d33 100644 --- a/src/analysis/expression.cpp +++ b/src/analysis/expression.cpp @@ -29,6 +29,7 @@ #include "nodes/expr/bind_expr.h" #include "nodes/expr/compound_expr.h" #include "nodes/expr/cond_expr.h" +#include "nodes/expr/decl_expr.h" #include "nodes/expr/eq_expr.h" #include "nodes/expr/modify_expr.h" #include "nodes/expr/ne_expr.h" @@ -276,6 +277,7 @@ void analyseCondExpr(CondExprNode *node, const WalkItem &wi, WalkItem &wo) { wo.removeNullVars.insert(*it); wo.checkNullVars.erase(*it); + wo.addNullVars.erase(*it); } } if (wo3.isReturned) @@ -287,6 +289,7 @@ void analyseCondExpr(CondExprNode *node, const WalkItem &wi, WalkItem &wo) { wo.removeNullVars.insert(*it); wo.checkNullVars.erase(*it); + wo.addNullVars.erase(*it); } } @@ -368,4 +371,26 @@ void analyseBindExpr(BindExprNode *node, const WalkItem &wi, WalkItem &wo) Log::dumpWI(node, "wo out ", wo); } +// type var1 = var2; +void analyseDeclExpr(DeclExprNode *node, const WalkItem &wi, WalkItem &wo) +{ + // need one arg for check + if (node->args.empty() || command == FindArgs) + return; + + Node *node1 = skipNop(node->args[0]); + + if (node1 && + node1->nodeType == VAR_DECL) + { + VarDeclNode *varDecl = static_cast<VarDeclNode*>(node1); + Node *initial = varDecl->initial; + if (checkForReport(initial, wi)) + { + wo.addNullVars.insert(varDecl->label); + addLinkedVar(wo, initial->label, varDecl->label); + } + } +} + } |