[Dlang-internal] Finding the module that caused a template instanciation
Benjamin Thaut
code at benjamin-thaut.de
Mon Dec 18 12:33:26 UTC 2017
For my dll work I need some pointers from someone who has a
deeper understanding of how the template implementation inside
dmd works. Here is the problem
Given a template instance I need to know which module caused this
template to be instanciated. I don't need the module the template
was declared in but instead the module that triggered the
instanciation. This also has to work in cases where the compiler
re-uses existing template instances. In a re-use case I need the
module that caused instaciation of the re-used instance.
Example:
module a;
struct SomeTemplate(T){ ... }
module b;
SomeTemplate!int g_var;
When looking at template instace caused by the g_var declaration
I need to know that it was instanciated because the module "b"
requested it.
Looking at the data structures conntected to templates and the
template instance I got the impression that this information is
currently not stored in the compiler internal data structures. In
case this actually is not stored yet, what would be the best
place to add it?
Kind Regards
Benjamin Thaut
More information about the Dlang-internal
mailing list