From fa8b674ef4cb32cb92bcc4f3d42bf24b8cf3b7fb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 17 Jul 2015 12:53:58 +0200 Subject: Diagnose "composite type used before definition" situations --- odb/context.cxx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'odb/context.cxx') 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 ("definition"); - } - else if (c.is_a ()) - { - return c.get ("location"); - } - else - { - return real_source_location (TYPE_NAME (c.tree_node ())); - } + return c.count ("definition") + ? c.get ("definition") + : class_real_location (c); +} + +location_t context:: +class_real_location (semantics::class_& c) +{ + return c.is_a () + ? c.get ("location") + : real_source_location (TYPE_NAME (c.tree_node ())); } string context:: -- cgit v1.1