aboutsummaryrefslogtreecommitdiff
path: root/odb/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-17 12:53:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-17 12:53:58 +0200
commitfa8b674ef4cb32cb92bcc4f3d42bf24b8cf3b7fb (patch)
treefee686936eb4150208e58ee81164931199c79e0e /odb/context.cxx
parent8f6a9c51bc64226d7c296e4b0172f9e56a7eea3b (diff)
Diagnose "composite type used before definition" situations
Diffstat (limited to 'odb/context.cxx')
-rw-r--r--odb/context.cxx23
1 files changed, 11 insertions, 12 deletions
diff --git a/odb/context.cxx b/odb/context.cxx
index 59058ba..6dcf987 100644
--- a/odb/context.cxx
+++ b/odb/context.cxx
@@ -1335,18 +1335,17 @@ class_file (semantics::class_& c)
location_t context::
class_location (semantics::class_& c)
{
- if (c.count ("definition"))
- {
- return c.get<location_t> ("definition");
- }
- else if (c.is_a<semantics::class_instantiation> ())
- {
- return c.get<location_t> ("location");
- }
- else
- {
- return real_source_location (TYPE_NAME (c.tree_node ()));
- }
+ return c.count ("definition")
+ ? c.get<location_t> ("definition")
+ : class_real_location (c);
+}
+
+location_t context::
+class_real_location (semantics::class_& c)
+{
+ return c.is_a<semantics::class_instantiation> ()
+ ? c.get<location_t> ("location")
+ : real_source_location (TYPE_NAME (c.tree_node ()));
}
string context::