diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-27 20:01:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-27 20:01:26 +0300 |
commit | f8e82463820924320ca302434c702b822d2b4ce1 (patch) | |
tree | 2f3b937fdf3c098363494cd317e8c08e80cbd9ef /src | |
parent | 64199285a76d0ae456b9273884fdf4b2e21dc9ab (diff) | |
download | paranucker-f8e82463820924320ca302434c702b822d2b4ce1.tar.gz paranucker-f8e82463820924320ca302434c702b822d2b4ce1.tar.bz2 paranucker-f8e82463820924320ca302434c702b822d2b4ce1.tar.xz paranucker-f8e82463820924320ca302434c702b822d2b4ce1.zip |
Extract some code from analyseFunctionDecl.
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/function.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
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<TypeNode*> types; std::set<int> 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; } } |