From f8e82463820924320ca302434c702b822d2b4ce1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 27 Jun 2015 20:01:26 +0300 Subject: Extract some code from analyseFunctionDecl. --- src/analysis/function.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/analysis/function.cpp b/src/analysis/function.cpp index 70b4389..ff0f186 100644 --- a/src/analysis/function.cpp +++ b/src/analysis/function.cpp @@ -95,18 +95,10 @@ void getFunctionParamsNonNullAttributes(FunctionDeclNode *node, } } -void analyseFunction(FunctionDeclNode *node, const WalkItem &wi, WalkItem &wo) +void getPossibleNullParameters(FunctionDeclNode *node, WalkItem &wi) { - // ignore external functions - if (node->isExternal) - { - wo.stopWalking = true; - return; - } - std::vector types; std::set nonNull; - WalkItem wi2 = wi; getFunctionArgTypes(node, types); getFunctionParamsNonNullAttributes(node, nonNull); @@ -133,17 +125,29 @@ void analyseFunction(FunctionDeclNode *node, const WalkItem &wi, WalkItem &wo) type->nodeTypeName.c_str(), name->label.c_str()); } - wi2.checkNullVars.insert(name->label); + wi.checkNullVars.insert(name->label); } } if (command == Command::FindArgs) Log::log("\n"); +} - if (!wi2.checkNullVars.empty()) +void analyseFunction(FunctionDeclNode *node, const WalkItem &wi, WalkItem &wo) +{ + // ignore external functions + if (node->isExternal) { + wo.stopWalking = true; + return; + } + + if (node->code) + { // probably function definition + WalkItem wi2 = wi; + getPossibleNullParameters(node, wi2); walkTree(node->code, wi2, wo); + wo.stopWalking = true; } - wo.stopWalking = true; } } -- cgit v1.2.3-60-g2f50