File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -458,6 +458,15 @@ class Class extends UserType {
458458 exists ( ClassDerivation d | d .getDerivedClass ( ) = this and d = result )
459459 }
460460
461+ /**
462+ * Gets class derivation number `index` of this class/struct, for example the
463+ * `public B` is derivation 1 in the following code:
464+ * ```
465+ * class D : public A, public B, public C {
466+ * ...
467+ * };
468+ * ```
469+ */
461470 ClassDerivation getDerivation ( int index ) {
462471 exists ( ClassDerivation d | d .getDerivedClass ( ) = this and d .getIndex ( ) = index and d = result )
463472 }
@@ -900,6 +909,22 @@ class AbstractClass extends Class {
900909class TemplateClass extends Class {
901910 TemplateClass ( ) { usertypes ( underlyingElement ( this ) , _, 6 ) }
902911
912+ /**
913+ * Gets a class instantiated from this template.
914+ *
915+ * For example for `MyTemplateClass<T>` in the following code, the results are
916+ * `MyTemplateClass<int>` and `MyTemplateClass<long>`:
917+ * ```
918+ * template<class T>
919+ * class MyTemplateClass {
920+ * ...
921+ * };
922+ *
923+ * MyTemplateClass<int> instance;
924+ *
925+ * MyTemplateClass<long> instance;
926+ * ```
927+ */
903928 Class getAnInstantiation ( ) {
904929 result .isConstructedFrom ( this ) and
905930 exists ( result .getATemplateArgument ( ) )
You can’t perform that action at this time.
0 commit comments