aboutsummaryrefslogtreecommitdiff
path: root/odb/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-04-19 17:54:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-04-19 17:54:23 +0200
commit53d846e0c6ce605c3bce5c902829e0c0ce70e444 (patch)
tree766930494cec032fc4d131aa10eea8fac15a938d /odb/parser.cxx
parent2811680d652989ab2e2f9e12efd6f6de6169fa18 (diff)
Store enumerator values in semantics graph
Diffstat (limited to 'odb/parser.cxx')
-rw-r--r--odb/parser.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/odb/parser.cxx b/odb/parser.cxx
index 23e9faa..a40a298 100644
--- a/odb/parser.cxx
+++ b/odb/parser.cxx
@@ -1234,7 +1234,8 @@ emit_enum (tree e,
}
else
{
- e_node = &unit_->new_node<enum_> (file, line, clmn, e);
+ e_node = &unit_->new_node<enum_> (
+ file, line, clmn, e, TYPE_UNSIGNED (e) != 0);
unit_->insert (e, *e_node);
}
@@ -1246,11 +1247,22 @@ emit_enum (tree e,
for (tree er (TYPE_VALUES (e)); er != NULL_TREE ; er = TREE_CHAIN (er))
{
char const* name (IDENTIFIER_POINTER (TREE_PURPOSE (er)));
+ tree tval (DECL_INITIAL (TREE_VALUE (er)));
+
+ HOST_WIDE_INT hwl (TREE_INT_CST_LOW (tval));
+ HOST_WIDE_INT hwh (TREE_INT_CST_HIGH (tval));
+
+ unsigned long long l (hwl);
+ unsigned long long h (hwh);
+ unsigned short width (HOST_BITS_PER_WIDE_INT);
+
+ unsigned long long val ((h << width) + l);
// There doesn't seem to be a way to get the proper position for
// each enumerator.
//
- enumerator& er_node = unit_->new_node<enumerator> (file, line, clmn, er);
+ enumerator& er_node = unit_->new_node<enumerator> (
+ file, line, clmn, er, val);
unit_->new_edge<enumerates> (*e_node, er_node);
// Inject enumerators into the outer scope.