summaryrefslogtreecommitdiff
path: root/src/parsers/decl
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-12 17:10:43 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-12 17:10:43 +0300
commit5523103f7f9d0331c65b3c931533519d2d18c838 (patch)
tree526257773105c5a6b426fd916def6d31c6b02758 /src/parsers/decl
parent935220297043e59853d54697bdf51c96ac1d1812 (diff)
downloadparanucker-5523103f7f9d0331c65b3c931533519d2d18c838.tar.gz
paranucker-5523103f7f9d0331c65b3c931533519d2d18c838.tar.bz2
paranucker-5523103f7f9d0331c65b3c931533519d2d18c838.tar.xz
paranucker-5523103f7f9d0331c65b3c931533519d2d18c838.zip
Add parsing node FIELD_DECL.
Diffstat (limited to 'src/parsers/decl')
-rw-r--r--src/parsers/decl/field_decl.cpp75
-rw-r--r--src/parsers/decl/var_decl.cpp1
2 files changed, 76 insertions, 0 deletions
diff --git a/src/parsers/decl/field_decl.cpp b/src/parsers/decl/field_decl.cpp
new file mode 100644
index 0000000..14b8789
--- /dev/null
+++ b/src/parsers/decl/field_decl.cpp
@@ -0,0 +1,75 @@
+/*
+ * 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(FieldDecl);
+
+#include "parsers/base/decl.h"
+
+#include "nodes/decl/field_decl.h"
+
+namespace Generic
+{
+
+void parseFieldDeclNode(FieldDeclNode *node)
+{
+ fillType(node);
+ fillLocation(node);
+ fillDeclLabel(node);
+ Log::dump(node);
+
+ setPrintField(node, DECL_C_BIT_FIELD, isBitField);
+ node->isUnsigned = DECL_UNSIGNED(node->gccNode);
+ if (node->isUnsigned)
+ Log::dumpRaw(node, "- unsigned");
+ else
+ Log::dumpRaw(node, "- signed");
+ setPrintField(node, DECL_VIRTUAL_P, isVirtual);
+ setPrintField(node, DECL_PACKED, isBitPacked);
+
+ fillDeclAutoGenerated(node);
+ fillDeclAttributes(node);
+
+ if (node->isBitField)
+ {
+ node->declBitType = static_cast<TypeNode*>(createParseNode(
+ node,
+ DECL_BIT_FIELD_TYPE(node->gccNode),
+ "decl bit type"));
+ }
+
+ node->declSize = static_cast<IntegerCstNode*>(createParseNode(
+ node,
+ DECL_SIZE(node->gccNode),
+ INTEGER_CST,
+ "decl size"));
+
+ node->initial = createParseNode(
+ node,
+ DECL_INITIAL(node->gccNode),
+ "initial");
+
+ node->qualifier = createParseNode(
+ node,
+ DECL_QUALIFIER(node->gccNode),
+ "qualifier");
+}
+
+}
diff --git a/src/parsers/decl/var_decl.cpp b/src/parsers/decl/var_decl.cpp
index 1d03446..09afed1 100644
--- a/src/parsers/decl/var_decl.cpp
+++ b/src/parsers/decl/var_decl.cpp
@@ -41,6 +41,7 @@ void parseVarDeclNode(VarDeclNode *node)
setPrintField(node, DECL_THIS_STATIC, isStatic);
setPrintField(node, DECL_REGISTER, isRegister);
setPrintField(node, TREE_USED, isUsed);
+ setPrintField(node, DECL_VIRTUAL_P, isVirtual);
fillDeclAutoGenerated(node);