summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.files4
-rw-r--r--src/includes/nodeincludes.h1
-rw-r--r--src/includes/nodeshandling.inc1
-rw-r--r--src/includes/parserdefines.inc1
-rw-r--r--src/nodes/ref/array_ref.h40
-rw-r--r--src/parsers/ref/array_ref.cpp56
6 files changed, 102 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files
index 25e03ae..8e4eb68 100644
--- a/src/Makefile.files
+++ b/src/Makefile.files
@@ -266,4 +266,6 @@ SRC = analysis/analysis.cpp \
nodes/expr/asm_expr.h \
parsers/expr/asm_expr.cpp \
nodes/expr/throw_expr.h \
- parsers/expr/throw_expr.cpp \ No newline at end of file
+ parsers/expr/throw_expr.cpp \
+ nodes/ref/array_ref.h \
+ parsers/ref/array_ref.cpp \ No newline at end of file
diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h
index 0d6e963..6748aa0 100644
--- a/src/includes/nodeincludes.h
+++ b/src/includes/nodeincludes.h
@@ -111,3 +111,4 @@
#include "nodes/ref/objtype_ref.h"
#include "nodes/expr/asm_expr.h"
#include "nodes/expr/throw_expr.h"
+#include "nodes/ref/array_ref.h"
diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc
index ae0234a..a6e4e21 100644
--- a/src/includes/nodeshandling.inc
+++ b/src/includes/nodeshandling.inc
@@ -110,3 +110,4 @@ handleNodeType(FIX_TRUNC_EXPR, FixTruncExpr)
handleNodeType(OBJ_TYPE_REF, ObjTypeRef)
handleNodeType(ASM_EXPR, AsmExpr)
handleNodeType(THROW_EXPR, ThrowExpr)
+handleNodeType(ARRAY_REF, ArrayRef)
diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc
index 9571365..9d72b0d 100644
--- a/src/includes/parserdefines.inc
+++ b/src/includes/parserdefines.inc
@@ -110,3 +110,4 @@ parserDefine(FixTruncExpr);
parserDefine(ObjTypeRef);
parserDefine(AsmExpr);
parserDefine(ThrowExpr);
+parserDefine(ArrayRef);
diff --git a/src/nodes/ref/array_ref.h b/src/nodes/ref/array_ref.h
new file mode 100644
index 0000000..48f619e
--- /dev/null
+++ b/src/nodes/ref/array_ref.h
@@ -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/>.
+ */
+
+#ifndef NODES_REF_ARRAYREFNODE_H
+#define NODES_REF_ARRAYREFNODE_H
+
+#include "nodes/base/ref.h"
+
+#include <string>
+
+struct ArrayRefNode : public RefNode
+{
+ ArrayRefNode() :
+ RefNode(),
+ elementSize(nullptr),
+ lowBound(nullptr)
+ {
+ }
+
+ Node *elementSize;
+ Node *lowBound;
+};
+
+#endif // NODES_REF_ARRAYREFNODE_H
diff --git a/src/parsers/ref/array_ref.cpp b/src/parsers/ref/array_ref.cpp
new file mode 100644
index 0000000..584b65b
--- /dev/null
+++ b/src/parsers/ref/array_ref.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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(ArrayRef);
+
+#include "parsers/base/ref.h"
+
+#include "nodes/ref/array_ref.h"
+
+#include "rtl.h"
+#include "expr.h"
+
+namespace Generic
+{
+
+void parseArrayRefNode(ArrayRefNode *node)
+{
+ fillType(node);
+ fillRefLocation(node);
+ Log::dump(node);
+
+ node->lowBound = createParseNode(
+ node,
+ array_ref_low_bound(node->gccNode),
+ "low bound");
+
+ node->elementSize = createParseNode(
+ node,
+ array_ref_element_size(node->gccNode),
+ "element size");
+
+ fillRefOperands(node);
+
+ // args 0 array
+ // args 1 index
+}
+
+}