@@ -75,6 +75,18 @@ class TemplateTemplateParameter extends TypeTemplateParameter {
7575 TemplateTemplateParameter ( ) { usertypes ( underlyingElement ( this ) , _, 8 ) }
7676
7777 override string getAPrimaryQlClass ( ) { result = "TemplateTemplateParameter" }
78+
79+ /**
80+ * Gets a class instantiated from this template template parameter.
81+ *
82+ * For example for `Container<T>` in the following code, the results is
83+ * `Container<Elem>`:
84+ * ```
85+ * template <template <typename T> class Container, class Elem>
86+ * void foo(const Container<Elem> &value) { }
87+ * ```
88+ */
89+ Class getAnInstantiation ( ) { result .isConstructedFrom ( this ) }
7890}
7991
8092/**
@@ -90,3 +102,32 @@ class AutoType extends TypeTemplateParameter {
90102
91103 override Location getLocation ( ) { result instanceof UnknownDefaultLocation }
92104}
105+
106+ /**
107+ * A class that is an instantiation of a template template parameter. For example,
108+ * in the following code there is a `Container<Elem>` instantiation:
109+ * ```
110+ * template <template <typename T> class Container, class Elem>
111+ * void foo(const Container<Elem> &value) { }
112+ * ```
113+ * For the `Container` template itself, see `TemplateTemplateParameter`.
114+ */
115+ class TemplateTemplateParameterInstantiation extends Class {
116+ TemplateTemplateParameter ttp ;
117+
118+ TemplateTemplateParameterInstantiation ( ) { ttp .getAnInstantiation ( ) = this }
119+
120+ override string getAPrimaryQlClass ( ) { result = "TemplateTemplateParameterInstantiation" }
121+
122+ /**
123+ * Gets the template template parameter from which this instantiation was instantiated.
124+ *
125+ * For example for `Container<Elem>` in the following code, the result is
126+ * `Container<T>`:
127+ * ```
128+ * template <template <typename T> class Container, class Elem>
129+ * void foo(const Container<Elem> &value) { }
130+ * ```
131+ */
132+ TemplateTemplateParameter getTemplate ( ) { result = ttp }
133+ }
0 commit comments