diff options
Diffstat (limited to 'src')
-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/decl/template_decl.h | 42 | ||||
-rw-r--r-- | src/parsers/decl/template_decl.cpp | 54 |
6 files changed, 102 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index 8625cb2..903232a 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -237,4 +237,6 @@ SRC = analysis/analysis.cpp \ nodes/decl/using_decl.h \ parsers/decl/using_decl.cpp \ nodes/decl/const_decl.h \ - parsers/decl/const_decl.cpp
\ No newline at end of file + parsers/decl/const_decl.cpp \ + nodes/decl/template_decl.h \ + parsers/decl/template_decl.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 1904773..6f91892 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -98,3 +98,4 @@ #include "nodes/decl/label_decl.h" #include "nodes/decl/using_decl.h" #include "nodes/decl/const_decl.h" +#include "nodes/decl/template_decl.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index 32d910b..7591aaf 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -97,3 +97,4 @@ handleNodeType(COMPOUND_EXPR, CompoundExpr) handleNodeType(LABEL_DECL, LabelDecl) handleNodeType(USING_DECL, UsingDecl) handleNodeType(CONST_DECL, ConstDecl) +handleNodeType(TEMPLATE_DECL, TemplateDecl) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 204c43e..454f9a4 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -97,3 +97,4 @@ parserDefine(CompoundExpr); parserDefine(LabelDecl); parserDefine(UsingDecl); parserDefine(ConstDecl); +parserDefine(TemplateDecl); diff --git a/src/nodes/decl/template_decl.h b/src/nodes/decl/template_decl.h new file mode 100644 index 0000000..15975f4 --- /dev/null +++ b/src/nodes/decl/template_decl.h @@ -0,0 +1,42 @@ +/* + * 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_DECL_TEMPLATEDECLNODE_H +#define NODES_DECL_TEMPLATEDECLNODE_H + +#include "nodes/base/decl.h" + +#include "nodes/list/tree_list.h" + +#include <string> + +struct TemplateDeclNode : public DeclNode +{ + TemplateDeclNode() : + DeclNode(), + instantiations(nullptr), + specializations(nullptr) + { + } + + TreeListNode *instantiations; + TreeListNode *specializations; +}; + +#endif // NODES_DECL_TEMPLATEDECLNODE_H diff --git a/src/parsers/decl/template_decl.cpp b/src/parsers/decl/template_decl.cpp new file mode 100644 index 0000000..46a71ac --- /dev/null +++ b/src/parsers/decl/template_decl.cpp @@ -0,0 +1,54 @@ +/* + * 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(TemplateDecl); + +#include "parsers/base/decl.h" + +#include "nodes/decl/template_decl.h" + +namespace Generic +{ + +void parseTemplateDeclNode(TemplateDeclNode *node) +{ + fillType(node); + fillLocation(node); + fillDeclLabel(node); + Log::dump(node); + + fillDeclAutoGenerated(node); + fillDeclAttributes(node); + + node->specializations = static_cast<TreeListNode*>(createParseNode( + node, + DECL_TEMPLATE_SPECIALIZATIONS(node->gccNode), + TREE_LIST, + "specialisation")); + + node->instantiations = static_cast<TreeListNode*>(createParseNode( + node, + DECL_TEMPLATE_INSTANTIATIONS(node->gccNode), + TREE_LIST, + "instantiations")); +} + +} |