aboutsummaryrefslogtreecommitdiff
path: root/odb/semantics
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-04-25 18:30:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-04-25 19:25:48 +0200
commit2f1d254fb49e8cc8bd9ea2137758614e5825eaed (patch)
tree40e632c43b8ef470892b5ba3a0a9cbbcd9675cd1 /odb/semantics
parentc4af692746181b5bb0ac50489555341feefd943c (diff)
Add typedef hints, move hint map to semantics::unit
Diffstat (limited to 'odb/semantics')
-rw-r--r--odb/semantics/elements.hxx18
-rw-r--r--odb/semantics/unit.hxx19
2 files changed, 36 insertions, 1 deletions
diff --git a/odb/semantics/elements.hxx b/odb/semantics/elements.hxx
index b11211e..25b412a 100644
--- a/odb/semantics/elements.hxx
+++ b/odb/semantics/elements.hxx
@@ -223,9 +223,24 @@ namespace semantics
return access_;
}
+ // Names edge in terms of which this edge was defined. Can be NULL.
+ //
+ public:
+ void
+ hint (names& hint)
+ {
+ hint_ = &hint;
+ }
+
+ names*
+ hint () const
+ {
+ return hint_;
+ }
+
public:
names (string const& name, access_type access = access_type::public_)
- : name_ (name), access_ (access)
+ : name_ (name), access_ (access), hint_ (0)
{
}
@@ -246,6 +261,7 @@ namespace semantics
nameable* named_;
string name_;
access_type access_;
+ names* hint_;
};
//
diff --git a/odb/semantics/unit.hxx b/odb/semantics/unit.hxx
index 306d4c3..ac9f4f5 100644
--- a/odb/semantics/unit.hxx
+++ b/odb/semantics/unit.hxx
@@ -38,6 +38,22 @@ namespace semantics
tree_node_map_[key] = &value;
}
+ // Mapping from tree nodes to name hints.
+ //
+ public:
+ names*
+ find_hint (tree key) const
+ {
+ name_hint_map::const_iterator i (name_hint_map_.find (key));
+ return i != name_hint_map_.end () ? i->second : 0;
+ }
+
+ void
+ insert_hint (tree key, names& name)
+ {
+ name_hint_map_[key] = &name;
+ }
+
public:
template <class T>
T&
@@ -158,6 +174,9 @@ namespace semantics
typedef std::map<tree, node*> tree_node_map;
tree_node_map tree_node_map_;
+
+ typedef std::map<tree, names*> name_hint_map;
+ name_hint_map name_hint_map_;
};
}