diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-12 00:39:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-12 00:39:15 +0300 |
commit | 02ed297d531eabef1c381cfc8104d591621bc941 (patch) | |
tree | 6210a4d90b1e009202bbf49c66ecec305581a9fc | |
parent | e6916af5a3f6a7bee468aa4df3c102b2ad80d868 (diff) | |
download | paranucker-02ed297d531eabef1c381cfc8104d591621bc941.tar.gz paranucker-02ed297d531eabef1c381cfc8104d591621bc941.tar.bz2 paranucker-02ed297d531eabef1c381cfc8104d591621bc941.tar.xz paranucker-02ed297d531eabef1c381cfc8104d591621bc941.zip |
Add parsing node BOOLEAN_TYPE.
-rw-r--r-- | src/Makefile.files | 4 | ||||
-rw-r--r-- | src/includes/nodeincludes.h | 1 | ||||
-rw-r--r-- | src/includes/nodeshandling.inc | 1 | ||||
-rw-r--r-- | src/includes/parserdefines.inc | 1 | ||||
-rw-r--r-- | src/nodes/type/boolean_type.h | 35 | ||||
-rw-r--r-- | src/parsers/type/boolean_type.cpp | 40 | ||||
-rw-r--r-- | test/test1-01.txt | 30 | ||||
-rw-r--r-- | test/test1-02.txt | 21 | ||||
-rw-r--r-- | test/test1-03.txt | 2 | ||||
-rw-r--r-- | test/test1.c | 3 |
10 files changed, 137 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index ff8330e..06221e2 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -115,4 +115,6 @@ SRC = analysis/analysis.cpp \ nodes/expr/cond_expr.h \ parsers/expr/cond_expr.cpp \ nodes/expr/pointerplus_expr.h \ - parsers/expr/pointerplus_expr.cpp
\ No newline at end of file + parsers/expr/pointerplus_expr.cpp \ + nodes/type/boolean_type.h \ + parsers/type/boolean_type.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 12ecde1..cff2090 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -39,3 +39,4 @@ #include "nodes/expr/nop_expr.h" #include "nodes/expr/cond_expr.h" #include "nodes/expr/pointerplus_expr.h" +#include "nodes/type/boolean_type.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index 2ee25d0..9c0e7f9 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -38,3 +38,4 @@ handleNodeType(LOOP_EXPR, LoopExpr) handleNodeType(NOP_EXPR, NopExpr) handleNodeType(COND_EXPR, CondExpr) handleNodeType(POINTER_PLUS_EXPR, PointerPlusExpr) +handleNodeType(BOOLEAN_TYPE, BooleanType) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 48e74f9..83a23c9 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -38,3 +38,4 @@ parserDefine(LoopExpr); parserDefine(NopExpr); parserDefine(CondExpr); parserDefine(PointerPlusExpr); +parserDefine(BooleanType); diff --git a/src/nodes/type/boolean_type.h b/src/nodes/type/boolean_type.h new file mode 100644 index 0000000..25bbc5b --- /dev/null +++ b/src/nodes/type/boolean_type.h @@ -0,0 +1,35 @@ +/* + * 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/>. + */ + +#ifndef NODES_TYPE_BOOLEANTYPENODE_H +#define NODES_TYPE_BOOLEANTYPENODE_H + +#include "nodes/base/type.h" + +#include <string> + +struct BooleanTypeNode : public TypeNode +{ + BooleanTypeNode() : + TypeNode() + { + } +}; + +#endif // NODES_TYPE_BOOLEANTYPENODE_H diff --git a/src/parsers/type/boolean_type.cpp b/src/parsers/type/boolean_type.cpp new file mode 100644 index 0000000..4a61de1 --- /dev/null +++ b/src/parsers/type/boolean_type.cpp @@ -0,0 +1,40 @@ +/* + * 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 "includes/parserincludes.h" + +parserDefine(BooleanType); + +#include "parsers/base/type.h" + +#include "nodes/type/boolean_type.h" + +namespace Generic +{ + +void parseBooleanTypeNode(BooleanTypeNode *node) +{ + fillType(node); + Log::dump(node); + + fillTypeName(node); + fillTypeAttributes(node); +} + +} diff --git a/test/test1-01.txt b/test/test1-01.txt index 6ddfb33..1af6beb 100644 --- a/test/test1-01.txt +++ b/test/test1-01.txt @@ -702,3 +702,33 @@ function_decl fun2 test1.c 38:6 integer_cst -128 - min value integer_cst 127 - max value integer_cst 64 - parm size +function_decl funb test1.c 39:6 +- isPublic: 1 + function_type - function type + void_type - function return type + type_decl void <built-in> 0:0 - type name + - isAutogenerated: 1 + tree_list - arg types + boolean_type - value + type_decl bool <built-in> 0:0 - type name + - isAutogenerated: 1 + tree_list - chain + void_type - value + type_decl void <built-in> 0:0 - type name + - isAutogenerated: 1 + result_decl test1.c 39:21 - function result + - isAutogenerated: 1 + void_type - result type + type_decl void <built-in> 0:0 - type name + - isAutogenerated: 1 + parm_decl bool1 test1.c 39:16 - argument + integer_type - decl type + - precisionBits: 32 + - signed + type_decl int <built-in> 0:0 - type name + - isAutogenerated: 1 + integer_cst 32 - type size + integer_cst -2147483648 - min value + integer_cst 2147483647 - max value + integer_cst 8 - parm size + statement_list - code diff --git a/test/test1-02.txt b/test/test1-02.txt index 533c13b..43ebba9 100644 --- a/test/test1-02.txt +++ b/test/test1-02.txt @@ -485,3 +485,24 @@ 7 integer_cst 7 integer_cst 5 integer_cst +0 function_decl test1.c +1 function_type +2 void_type +3 type_decl <built-in> +2 tree_list +3 boolean_type +4 type_decl <built-in> +3 tree_list +4 void_type +5 type_decl <built-in> +1 result_decl test1.c +2 void_type +3 type_decl <built-in> +1 parm_decl test1.c +2 integer_type +3 type_decl <built-in> +3 integer_cst +3 integer_cst +3 integer_cst +2 integer_cst +1 statement_list diff --git a/test/test1-03.txt b/test/test1-03.txt index ced6511..91d0ade 100644 --- a/test/test1-03.txt +++ b/test/test1-03.txt @@ -8,3 +8,5 @@ Allocations before cleanup: 168 Allocations after cleanup: 0 Allocations before cleanup: 50 Allocations after cleanup: 0 +Allocations before cleanup: 21 +Allocations after cleanup: 0 diff --git a/test/test1.c b/test/test1.c index ac55d19..8a36fe1 100644 --- a/test/test1.c +++ b/test/test1.c @@ -36,3 +36,6 @@ int fun1(const int x,int*** y) else return MAX123; } long fun2(const char* zz) { return (long)zz; } +void funb(bool bool1) +{ +} |