File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
cpp/ql/lib/semmle/code/cpp Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -590,6 +590,33 @@ class TemplateVariable extends Variable {
590590 Variable getAnInstantiation ( ) { result .isConstructedFrom ( this ) }
591591}
592592
593+ /**
594+ * A variable that is an instantiation of a template. For example
595+ * the instantiation `myTemplateVariable<int>` in the following code:
596+ * ```
597+ * template<class T>
598+ * T myTemplateVariable;
599+ *
600+ * void caller(int i) {
601+ * myTemplateVariable<int> = i;
602+ * }
603+ * ```
604+ */
605+ class VariableTemplateInstantiation extends Variable {
606+ TemplateVariable tv ;
607+
608+ VariableTemplateInstantiation ( ) { tv .getAnInstantiation ( ) = this }
609+
610+ override string getAPrimaryQlClass ( ) { result = "VariableTemplateInstantiation" }
611+
612+ /**
613+ * Gets the variable template from which this instantiation was instantiated.
614+ *
615+ * Example: For `int x<int>`, returns `T x`.
616+ */
617+ TemplateVariable getTemplate ( ) { result = tv }
618+ }
619+
593620/**
594621 * A non-static local variable or parameter that is not part of an
595622 * uninstantiated template. Uninstantiated templates are purely syntax, and
You can’t perform that action at this time.
0 commit comments