summaryrefslogtreecommitdiff
path: root/odb/semantics/elements.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-08-19 17:05:24 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-08-19 17:05:24 +0200
commit2b02d443ab344bc02dfc2891fb1a57c6520c393f (patch)
tree3bff59757b0ef986d70c67def93d689fb18a5b66 /odb/semantics/elements.cxx
parent33cd64535d2307a2e7884ee0796e1aae42937aaf (diff)
Use type names as specified in the header that we compile
Diffstat (limited to 'odb/semantics/elements.cxx')
-rw-r--r--odb/semantics/elements.cxx64
1 files changed, 62 insertions, 2 deletions
diff --git a/odb/semantics/elements.cxx b/odb/semantics/elements.cxx
index 29b1f8e..a25df86 100644
--- a/odb/semantics/elements.cxx
+++ b/odb/semantics/elements.cxx
@@ -21,13 +21,73 @@ namespace semantics
// nameable
//
+ bool nameable::
+ fq_anonymous () const
+ {
+ // Nameable is fq-anonymous if all the paths to the global scope
+ // have at least one anonymous link.
+ //
+ if (anonymous ())
+ return true;
+
+ if (named ().global_scope ())
+ return false;
+
+ if (defined_ != 0 && !defined_->scope ().fq_anonymous ())
+ return false;
+
+ for (names_list::const_iterator i (named_.begin ()), e (named_.end ());
+ i != e; ++i)
+ {
+ if (!(*i)->scope ().fq_anonymous ())
+ return false;
+ }
+
+ return true;
+ }
+
+ bool nameable::
+ fq_anonymous (names* hint) const
+ {
+ if (hint == 0 && defined_ == 0)
+ return true;
+
+ names& n (hint ? *hint : *defined_);
+
+ if (n.global_scope ())
+ return false;
+
+ return n.scope ().fq_anonymous ();
+ }
+
string nameable::
fq_name () const
{
if (named ().global_scope ())
return "";
- else
- return scope ().fq_name () + "::" + name ();
+
+ if (defined_ != 0 && !defined_->scope ().fq_anonymous ())
+ return defined_->scope ().fq_name () + "::" + name ();
+
+ for (names_list::const_iterator i (named_.begin ()), e (named_.end ());
+ i != e; ++i)
+ {
+ if (!(*i)->scope ().fq_anonymous ())
+ return (*i)->scope ().fq_name () + "::" + name ();
+ }
+
+ return "<anonymous>";
+ }
+
+ string nameable::
+ fq_name (names* hint) const
+ {
+ names& n (hint ? *hint : *defined_);
+
+ if (n.global_scope ())
+ return "";
+
+ return n.scope ().fq_name () + "::" + n.name ();
}
// scope