summaryrefslogtreecommitdiff
path: root/odb/context.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/context.cxx')
-rw-r--r--odb/context.cxx15
1 files changed, 12 insertions, 3 deletions
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::class_instantiation> ()
- ? semantics::path (LOCATION_FILE (c.get<location_t> ("location")))
- : c.file ();
+ // If we have an explicit definition location, use that.
+ //
+ if (c.count ("definition"))
+ return semantics::path (LOCATION_FILE (c.get<location_t> ("definition")));
+ //
+ // Otherwise, if it is a template instantiation, use the location
+ // of the qualifier.
+ //
+ else if (c.is_a<semantics::class_instantiation> ())
+ return semantics::path (LOCATION_FILE (c.get<location_t> ("location")));
+ else
+ return c.file ();
}
string context::