diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-17 12:53:58 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-17 12:53:58 +0200 |
commit | fa8b674ef4cb32cb92bcc4f3d42bf24b8cf3b7fb (patch) | |
tree | fee686936eb4150208e58ee81164931199c79e0e /odb/context.cxx | |
parent | 8f6a9c51bc64226d7c296e4b0172f9e56a7eea3b (diff) |
Diagnose "composite type used before definition" situations
Diffstat (limited to 'odb/context.cxx')
-rw-r--r-- | odb/context.cxx | 23 |
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:: |