diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-09 01:34:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-09 01:34:18 +0300 |
commit | 8b9fae9e094d1db4901829602f245fed789abbbe (patch) | |
tree | b9b524e911d514d4d577c9a1403d46c6012a408c /src/analysis/analysis.cpp | |
parent | 97bb75fd0ca1d7053715373f4fe6eb4bfa9c13b9 (diff) | |
download | paranucker-8b9fae9e094d1db4901829602f245fed789abbbe.tar.gz paranucker-8b9fae9e094d1db4901829602f245fed789abbbe.tar.bz2 paranucker-8b9fae9e094d1db4901829602f245fed789abbbe.tar.xz paranucker-8b9fae9e094d1db4901829602f245fed789abbbe.zip |
Add basic tree analysis. Dump function arguments and detect pointers without nonnull attribute
Diffstat (limited to 'src/analysis/analysis.cpp')
-rw-r--r-- | src/analysis/analysis.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/analysis/analysis.cpp b/src/analysis/analysis.cpp new file mode 100644 index 0000000..fa1672c --- /dev/null +++ b/src/analysis/analysis.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2015 Andrei Karas + * + * This file is part of AstDumper. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "analysis/analysis.h" + +#include "command.h" + +#include "analysis/function.h" + +#include "nodes/decl/function_decl.h" + +#include "localconsts.h" + +namespace Analysis +{ + +void walkTree(Node *node) +{ + analyseNode(node); + + FOR_EACH (std::vector<Node*>::iterator, it, node->childs) + { + walkTree(*it); + } +} + +void analyseNode(Node *node) +{ + // searching function declaration + if (node->nodeType == FUNCTION_DECL) + { + analyseFunction(static_cast<FunctionDeclNode*>(node)); + } +} + +} |