From 4fcb4ae749b3cf40f24ab1b9ddeb58b3ae0600f7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 31 Jul 2012 12:16:55 +0200 Subject: Add support for changing location that ODB views as class definition This is useful for making third-party/system types into ODB composite value types. New pragma: definition. New test: common/definition. --- odb/context.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'odb/context.cxx') diff --git a/odb/context.cxx b/odb/context.cxx index 693ada4..8335ec4 100644 --- a/odb/context.cxx +++ b/odb/context.cxx @@ -501,9 +501,18 @@ class_fq_name (semantics::class_& c) semantics::path context:: class_file (semantics::class_& c) { - return c.is_a () - ? semantics::path (LOCATION_FILE (c.get ("location"))) - : c.file (); + // If we have an explicit definition location, use that. + // + if (c.count ("definition")) + return semantics::path (LOCATION_FILE (c.get ("definition"))); + // + // Otherwise, if it is a template instantiation, use the location + // of the qualifier. + // + else if (c.is_a ()) + return semantics::path (LOCATION_FILE (c.get ("location"))); + else + return c.file (); } string context:: -- cgit v1.1