From ebea1825f3ad04450175043f4949b5e0db74e40e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 17 Jun 2015 00:46:39 +0300 Subject: Add parsing node TEMPLATE_TYPE_PARM. --- src/Makefile.files | 4 +++- src/includes/nodeincludes.h | 1 + src/includes/nodeshandling.inc | 1 + src/includes/parserdefines.inc | 1 + src/nodes/templatetypeparm.h | 38 +++++++++++++++++++++++++++++++++++++ src/parsers/templatetypeparm.cpp | 41 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 src/nodes/templatetypeparm.h create mode 100644 src/parsers/templatetypeparm.cpp diff --git a/src/Makefile.files b/src/Makefile.files index d2982cb..2e1e2a7 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -300,4 +300,6 @@ SRC = analysis/analysis.cpp \ nodes/stmt/switch_stmt.h \ parsers/stmt/switch_stmt.cpp \ nodes/targetoption.h \ - parsers/targetoption.cpp \ No newline at end of file + parsers/targetoption.cpp \ + nodes/templatetypeparm.h \ + parsers/templatetypeparm.cpp \ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 52bedcb..126da91 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -128,3 +128,4 @@ #include "nodes/expr/switch_expr.h" #include "nodes/stmt/switch_stmt.h" #include "nodes/targetoption.h" +#include "nodes/templatetypeparm.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index 0df5b2c..15fbb9f 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -127,3 +127,4 @@ handleNodeType(STATIC_CAST_EXPR, StaticCastExpr) handleNodeType(SWITCH_EXPR, SwitchExpr) handleNodeType(SWITCH_STMT, SwitchStmt) handleNodeType(TARGET_OPTION_NODE, TargetOption) +handleNodeType(TEMPLATE_TYPE_PARM, TemplateTypeParm) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 646238e..693b361 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -127,3 +127,4 @@ parserDefine(StaticCastExpr); parserDefine(SwitchExpr); parserDefine(SwitchStmt); parserDefine(TargetOption); +parserDefine(TemplateTypeParm); diff --git a/src/nodes/templatetypeparm.h b/src/nodes/templatetypeparm.h new file mode 100644 index 0000000..f4590cc --- /dev/null +++ b/src/nodes/templatetypeparm.h @@ -0,0 +1,38 @@ +/* + * 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 . + */ + +#ifndef NODES_TEMPLATETYPEPARMNODE_H +#define NODES_TEMPLATETYPEPARMNODE_H + +#include "nodes/base/node.h" + +#include + +struct TemplateTypeParmNode : public Node +{ + TemplateTypeParmNode() : + Node(), + index(nullptr) + { + } + + Node *index; +}; + +#endif // NODES_TEMPLATETYPEPARMNODE_H diff --git a/src/parsers/templatetypeparm.cpp b/src/parsers/templatetypeparm.cpp new file mode 100644 index 0000000..d824bc6 --- /dev/null +++ b/src/parsers/templatetypeparm.cpp @@ -0,0 +1,41 @@ +/* + * 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 . + */ + +#include "includes/parserincludes.h" + +parserDefine(TemplateTypeParm); + + +#include "nodes/templatetypeparm.h" + +namespace Generic +{ + +void parseTemplateTypeParmNode(TemplateTypeParmNode *node) +{ + fillType(node); + Log::dump(node); + + node->index = createParseNode( + node, + TEMPLATE_TYPE_PARM_INDEX(node->gccNode), + "index"); +} + +} -- cgit v1.2.3-70-g09d2