diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/custom/fixed-cp-tree.h | 61 | ||||
-rw-r--r-- | src/includes.h | 1 | ||||
-rw-r--r-- | src/parsers/decl/var_decl.cpp | 2 | ||||
-rw-r--r-- | src/parsers/handler.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/cleanup_stmt.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/do_stmt.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/expr_stmt.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/for_stmt.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/if_stmt.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/switch_stmt.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/while_stmt.cpp | 2 |
12 files changed, 63 insertions, 19 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index e884c5f..0b7b704 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -40,7 +40,7 @@ libastdumper_la_SOURCES = ${SRC} libastdumper_la_LDFLAGS = ${SHARED_LDFLAGS} libastdumper_la_CXXFLAGS = ${SHARED_CXXFLAGS} -libcppastdumper_la_SOURCES = ${SRC} +libcppastdumper_la_SOURCES = ${SRC} custom/fixed-cp-tree.h libcppastdumper_la_LDFLAGS = ${SHARED_LDFLAGS} libcppastdumper_la_CXXFLAGS = ${SHARED_CXXFLAGS} -DENABLE_CPPLANG diff --git a/src/custom/fixed-cp-tree.h b/src/custom/fixed-cp-tree.h new file mode 100644 index 0000000..9bebc6a --- /dev/null +++ b/src/custom/fixed-cp-tree.h @@ -0,0 +1,61 @@ +/* Definitions for C++ parsing and type checking. + Copyright (C) 1987-2015 Free Software Foundation, Inc. + Contributed by Michael Tiemann (tiemann@cygnus.com) + +This file is part of GCC. + +GCC 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, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef CUSTOM_FIXED_CP_TREE_H +#define CUSTOM_FIXED_CP_TREE_H + +#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \ + TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL) + +#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0) + +#define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0) +#define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1) +#define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE)) +#define DECL_THIS_STATIC(NODE) \ + DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE)) + +#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0) +#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1) +#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2) +#define SWITCH_STMT_SCOPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 3) + +#define CLEANUP_BODY(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0) +#define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1) +#define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 2) + +#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0) +#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1) + +#define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0) +#define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1) + +#define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0) +#define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1) +#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2) +#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3) +#define FOR_SCOPE(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 4) + +#define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0) +#define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1) +#define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2) +#define IF_SCOPE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 3) + +#endif // CUSTOM_FIXED_CP_TREE_H diff --git a/src/includes.h b/src/includes.h index 7a1ef5e..51a6999 100644 --- a/src/includes.h +++ b/src/includes.h @@ -45,6 +45,7 @@ #include "cp/cp-tree.h" #else #include "c-family/c-common.h" +#include "custom/fixed-cp-tree.h" #endif #include "diagnostic.h" diff --git a/src/parsers/decl/var_decl.cpp b/src/parsers/decl/var_decl.cpp index 88fef9b..09afed1 100644 --- a/src/parsers/decl/var_decl.cpp +++ b/src/parsers/decl/var_decl.cpp @@ -38,9 +38,7 @@ void parseVarDeclNode(VarDeclNode *node) Log::dump(node); -#ifdef ENABLE_CPPLANG setPrintField(node, DECL_THIS_STATIC, isStatic); -#endif setPrintField(node, DECL_REGISTER, isRegister); setPrintField(node, TREE_USED, isUsed); setPrintField(node, DECL_VIRTUAL_P, isVirtual); diff --git a/src/parsers/handler.cpp b/src/parsers/handler.cpp index da727c0..f1c62a6 100644 --- a/src/parsers/handler.cpp +++ b/src/parsers/handler.cpp @@ -31,7 +31,6 @@ void parseHandlerNode(HandlerNode *node) fillType(node); Log::dump(node); -#ifdef ENABLE_CPPLANG node->type = createParseNode( node, HANDLER_TYPE(node->gccNode), @@ -44,7 +43,6 @@ void parseHandlerNode(HandlerNode *node) node, HANDLER_BODY(node->gccNode), "body"); -#endif } } diff --git a/src/parsers/stmt/cleanup_stmt.cpp b/src/parsers/stmt/cleanup_stmt.cpp index dae9b4f..06f9b4e 100644 --- a/src/parsers/stmt/cleanup_stmt.cpp +++ b/src/parsers/stmt/cleanup_stmt.cpp @@ -35,7 +35,6 @@ void parseCleanupStmtNode(CleanupStmtNode *node) fillExprLocation(node); Log::dump(node); -#ifdef ENABLE_CPPLANG node->body = createParseNode( node, CLEANUP_BODY(node->gccNode), @@ -48,7 +47,6 @@ void parseCleanupStmtNode(CleanupStmtNode *node) node, CLEANUP_DECL(node->gccNode), "decl")); -#endif } } diff --git a/src/parsers/stmt/do_stmt.cpp b/src/parsers/stmt/do_stmt.cpp index 64491f6..1b485bc 100644 --- a/src/parsers/stmt/do_stmt.cpp +++ b/src/parsers/stmt/do_stmt.cpp @@ -38,7 +38,6 @@ void parseDoStmtNode(DoStmtNode *node) fillExprLocation(node); Log::dump(node); -#ifdef ENABLE_CPPLANG node->condition = static_cast<ExprNode*>(createParseNode( node, DO_COND(node->gccNode), @@ -48,7 +47,6 @@ void parseDoStmtNode(DoStmtNode *node) node, DO_BODY(node->gccNode), "body"); -#endif } } diff --git a/src/parsers/stmt/expr_stmt.cpp b/src/parsers/stmt/expr_stmt.cpp index b4bd954..a17a2dc 100644 --- a/src/parsers/stmt/expr_stmt.cpp +++ b/src/parsers/stmt/expr_stmt.cpp @@ -40,12 +40,10 @@ void parseExprStmtNode(ExprStmtNode *node) if (!node->parseChilds) return; -#ifdef ENABLE_CPPLANG node->expression = static_cast<ExprNode*>(createParseNode( node, EXPR_STMT_EXPR(node->gccNode), "expresssion")); -#endif } } diff --git a/src/parsers/stmt/for_stmt.cpp b/src/parsers/stmt/for_stmt.cpp index 3b67782..d06be43 100644 --- a/src/parsers/stmt/for_stmt.cpp +++ b/src/parsers/stmt/for_stmt.cpp @@ -35,7 +35,6 @@ void parseForStmtNode(ForStmtNode *node) fillExprLocation(node); Log::dump(node); -#ifdef ENABLE_CPPLANG node->init = static_cast<StmtNode*>(createParseNode( node, FOR_INIT_STMT(node->gccNode), @@ -55,7 +54,6 @@ void parseForStmtNode(ForStmtNode *node) node, FOR_BODY(node->gccNode), "body")); -#endif } } diff --git a/src/parsers/stmt/if_stmt.cpp b/src/parsers/stmt/if_stmt.cpp index 6b59202..92eaff7 100644 --- a/src/parsers/stmt/if_stmt.cpp +++ b/src/parsers/stmt/if_stmt.cpp @@ -38,7 +38,6 @@ void parseIfStmtNode(IfStmtNode *node) if (!node->parseChilds) return; -#ifdef ENABLE_CPPLANG node->condition = createParseNode( node, IF_COND(node->gccNode), @@ -56,7 +55,6 @@ void parseIfStmtNode(IfStmtNode *node) node, IF_SCOPE(node->gccNode), "score"); -#endif } } diff --git a/src/parsers/stmt/switch_stmt.cpp b/src/parsers/stmt/switch_stmt.cpp index c48b567..5fc1464 100644 --- a/src/parsers/stmt/switch_stmt.cpp +++ b/src/parsers/stmt/switch_stmt.cpp @@ -35,7 +35,6 @@ void parseSwitchStmtNode(SwitchStmtNode *node) fillExprLocation(node); Log::dump(node); -#ifdef ENABLE_CPPLANG node->condition = createParseNode( node, SWITCH_STMT_COND(node->gccNode), @@ -55,7 +54,6 @@ void parseSwitchStmtNode(SwitchStmtNode *node) node, SWITCH_STMT_SCOPE(node->gccNode), "scope"); -#endif } } diff --git a/src/parsers/stmt/while_stmt.cpp b/src/parsers/stmt/while_stmt.cpp index 54fc2d9..bb580f1 100644 --- a/src/parsers/stmt/while_stmt.cpp +++ b/src/parsers/stmt/while_stmt.cpp @@ -38,7 +38,6 @@ void parseWhileStmtNode(WhileStmtNode *node) if (!node->parseChilds) return; -#ifdef ENABLE_CPPLANG node->condition = createParseNode( node, WHILE_COND(node->gccNode), @@ -48,7 +47,6 @@ void parseWhileStmtNode(WhileStmtNode *node) node, WHILE_BODY(node->gccNode), "body"); -#endif } } |