diff options
-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/type/vector_type.h | 40 | ||||
-rw-r--r-- | src/parsers/type/vector_type.cpp | 49 |
6 files changed, 95 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index 7d166e6..55c1c31 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -128,4 +128,6 @@ SRC = analysis/analysis.cpp \ nodes/block/ehspec_block.h \ parsers/block/ehspec_block.cpp \ nodes/decl/field_decl.h \ - parsers/decl/field_decl.cpp
\ No newline at end of file + parsers/decl/field_decl.cpp \ + nodes/type/vector_type.h \ + parsers/type/vector_type.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 8f34475..df4be8a 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -45,3 +45,4 @@ #include "nodes/expr/target_expr.h" #include "nodes/block/ehspec_block.h" #include "nodes/decl/field_decl.h" +#include "nodes/type/vector_type.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index b649c05..78ea478 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -44,3 +44,4 @@ handleNodeType(RECORD_TYPE, RecordType) handleNodeType(TARGET_EXPR, TargetExpr) handleNodeType(EH_SPEC_BLOCK, EhSpecBlock) handleNodeType(FIELD_DECL, FieldDecl) +handleNodeType(VECTOR_TYPE, VectorType) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 907c211..a3fa493 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -44,3 +44,4 @@ parserDefine(RecordType); parserDefine(TargetExpr); parserDefine(EhSpecBlock); parserDefine(FieldDecl); +parserDefine(VectorType); diff --git a/src/nodes/type/vector_type.h b/src/nodes/type/vector_type.h new file mode 100644 index 0000000..8f43631 --- /dev/null +++ b/src/nodes/type/vector_type.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_TYPE_VECTORTYPENODE_H +#define NODES_TYPE_VECTORTYPENODE_H + +#include "nodes/base/type.h" + +#include <string> + +struct VectorTypeNode : public TypeNode +{ + VectorTypeNode() : + TypeNode(), + elementType(nullptr), + vectorSize(0) + { + } + + TypeNode *elementType; + int vectorSize; +}; + +#endif // NODES_TYPE_VECTORTYPENODE_H diff --git a/src/parsers/type/vector_type.cpp b/src/parsers/type/vector_type.cpp new file mode 100644 index 0000000..aef279b --- /dev/null +++ b/src/parsers/type/vector_type.cpp @@ -0,0 +1,49 @@ +/* + * 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(VectorType); + +#include "parsers/base/type.h" + +#include "nodes/type/vector_type.h" + +namespace Generic +{ + +void parseVectorTypeNode(VectorTypeNode *node) +{ + fillType(node); + Log::dump(node); + + setPrintField(node, TYPE_VECTOR_SUBPARTS, vectorSize); + + fillTypeName(node); + fillTypeAttributes(node); + + // TREE_TYPE - element type + + node->elementType = static_cast<TypeNode*>(createParseNode( + node, + TREE_TYPE(node->gccNode), + "element type")); +} + +} |