File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
cpp/ql/src/semmle/code/cpp Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,15 @@ class Class extends UserType {
458
458
exists ( ClassDerivation d | d .getDerivedClass ( ) = this and d = result )
459
459
}
460
460
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
+ */
461
470
ClassDerivation getDerivation ( int index ) {
462
471
exists ( ClassDerivation d | d .getDerivedClass ( ) = this and d .getIndex ( ) = index and d = result )
463
472
}
@@ -900,6 +909,22 @@ class AbstractClass extends Class {
900
909
class TemplateClass extends Class {
901
910
TemplateClass ( ) { usertypes ( underlyingElement ( this ) , _, 6 ) }
902
911
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
+ */
903
928
Class getAnInstantiation ( ) {
904
929
result .isConstructedFrom ( this ) and
905
930
exists ( result .getATemplateArgument ( ) )
You can’t perform that action at this time.
0 commit comments