summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/nodes/typedeclnode.h31
-rw-r--r--src/parsers/generic.cpp8
-rw-r--r--src/parsers/type_decl.cpp52
-rw-r--r--src/parsers/type_decl.h34
5 files changed, 128 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index f784baa..fd30a36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,7 @@ SRC = nodes/base/declnode.h \
nodes/parmdeclnode.h \
nodes/resultdeclnode.h \
nodes/treelistnode.h \
+ nodes/typedeclnode.h \
nodes/voidtypenode.h \
parsers/function_decl.cpp \
parsers/function_decl.h \
@@ -17,6 +18,8 @@ SRC = nodes/base/declnode.h \
parsers/generic.h \
parsers/result_decl.cpp \
parsers/result_decl.h \
+ parsers/type_decl.cpp \
+ parsers/type_decl.h \
parsers/void_type.cpp \
parsers/void_type.h \
parsers/base/decl.cpp \
diff --git a/src/nodes/typedeclnode.h b/src/nodes/typedeclnode.h
new file mode 100644
index 0000000..3d8999b
--- /dev/null
+++ b/src/nodes/typedeclnode.h
@@ -0,0 +1,31 @@
+/*
+ * 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_TYPEDECLNODE_H
+#define NODES_TYPEDECLNODE_H
+
+#include "nodes/base/declnode.h"
+
+#include <string>
+
+struct TypeDeclNode : public DeclNode
+{
+};
+
+#endif // NODES_TYPEDECLNODE_H
diff --git a/src/parsers/generic.cpp b/src/parsers/generic.cpp
index 977321b..1f53483 100644
--- a/src/parsers/generic.cpp
+++ b/src/parsers/generic.cpp
@@ -24,11 +24,13 @@
#include "nodes/functiondeclnode.h"
#include "nodes/functiontypenode.h"
#include "nodes/voidtypenode.h"
+#include "nodes/typedeclnode.h"
#include "parsers/function_decl.h"
#include "parsers/function_type.h"
#include "parsers/result_decl.h"
#include "parsers/void_type.h"
+#include "parsers/type_decl.h"
#include "localconsts.h"
@@ -64,6 +66,9 @@ Node *createParseNode(Node *parent,
case RESULT_DECL:
node = new ResultDeclNode;
break;
+ case TYPE_DECL:
+ node = new TypeDeclNode;
+ break;
case FUNCTION_TYPE:
node = new FunctionTypeNode;
break;
@@ -103,6 +108,9 @@ Node *createParseNode(Node *parent,
case RESULT_DECL:
parseResultDeclNode(static_cast<ResultDeclNode*>(node));
break;
+ case TYPE_DECL:
+ parseTypeDeclNode(static_cast<TypeDeclNode*>(node));
+ break;
case FUNCTION_TYPE:
parseFunctionTypeNode(static_cast<FunctionTypeNode*>(node));
break;
diff --git a/src/parsers/type_decl.cpp b/src/parsers/type_decl.cpp
new file mode 100644
index 0000000..9f5c011
--- /dev/null
+++ b/src/parsers/type_decl.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 "parsers/type_decl.h"
+
+#include "logger.h"
+
+#include "parsers/generic.h"
+
+#include "parsers/base/decl.h"
+
+#include "nodes/typedeclnode.h"
+
+#include "localconsts.h"
+
+namespace Generic
+{
+
+void parseTypeDeclNode(TypeDeclNode *node)
+{
+ fillType(node);
+ fillLocation(node);
+ fillDeclLabel(node);
+ Log::log(node);
+
+ fillDeclAutoGenerated(node);
+ fillDeclAttributes(node);
+
+// going to parent
+// createParseNode(
+// node,
+// TREE_TYPE(node->gccNode),
+// "result type");
+}
+
+}
diff --git a/src/parsers/type_decl.h b/src/parsers/type_decl.h
new file mode 100644
index 0000000..a26a713
--- /dev/null
+++ b/src/parsers/type_decl.h
@@ -0,0 +1,34 @@
+/*
+ * 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 PARSERS_TYPE_DECL_H
+#define PARSERS_TYPE_DECL_H
+
+#include "includes.h"
+
+#include <string>
+
+struct TypeDeclNode;
+
+namespace Generic
+{
+ void parseTypeDeclNode(TypeDeclNode *parent);
+}
+
+#endif // PARSERS_TYPE_DECL_H