We want to efficiently support passing around logical locations in the
diagnostics subsystem, such as:
- "within function 'foo'", or
- "within method 'bar'"
However we want to do this *without* requiring knowledge of trees (or of
libgdiagnostics internals), and without requiring heap allocation of an
interface class when emitting a diagnostic.
To do this, we split the implementation into logical_locations::key, which is
a wrapper around a (const void *), and logical_locations::manager which
is provided by the client and has vfunc hooks for interpreting
key instances.
Every logical_locations::key is associated with a logical_locations::manager
and only has meaning in relation to that manager.
A "nullptr" within a key means "no logical location".
See tree-logical-location.h for concrete subclasses relating to trees,
where the pointer is a const_tree.
See diagnostics/selftest-logical-locations.h for a concrete subclass for
selftests.
Extrinsic state for identifying a specific logical location.
This will be our logical location type.
This only makes sense with respect to a specific manager.
e.g. for a tree-based one it's a wrapper around "tree".
"nullptr" means "no logical location".
Note that there is no integration with GCC's garbage collector and thus
keys can't be long-lived.