@@ -684,7 +684,8 @@ class TypeidOperator extends Expr, @type_id {
684
684
}
685
685
686
686
/**
687
- * A C++11 `sizeof...` expression which determines the size of a template parameter pack.
687
+ * A C++11 `sizeof...` expression which determines the size of a template
688
+ * parameter pack.
688
689
*
689
690
* This expression only appears in templates themselves - in any actual
690
691
* instantiations, "sizeof...(x)" will be replaced by its integer value.
@@ -694,15 +695,56 @@ class TypeidOperator extends Expr, @type_id {
694
695
* ```
695
696
*/
696
697
class SizeofPackOperator extends Expr , @sizeof_pack {
697
- override string toString ( ) { result = "sizeof...(...)" }
698
-
699
- override string getAPrimaryQlClass ( ) { result = "SizeofPackOperator" }
700
-
701
698
override predicate mayBeImpure ( ) { none ( ) }
702
699
703
700
override predicate mayBeGloballyImpure ( ) { none ( ) }
704
701
}
705
702
703
+ /**
704
+ * A C++11 `sizeof...` expression which determines the size of a template
705
+ * parameter pack and whose operand is an expression.
706
+ *
707
+ * This expression only appears in templates themselves - in any actual
708
+ * instantiations, "sizeof...(x)" will be replaced by its integer value.
709
+ * ```
710
+ * template < typename... T >
711
+ * int count ( T &&... t ) { return sizeof... ( t ); }
712
+ * ```
713
+ */
714
+ class SizeofPackExprOperator extends SizeofPackOperator {
715
+ SizeofPackExprOperator ( ) { exists ( this .getChild ( 0 ) ) }
716
+
717
+ override string getAPrimaryQlClass ( ) { result = "SizeofPackExprOperator" }
718
+
719
+ /** Gets the contained expression. */
720
+ Expr getExprOperand ( ) { result = this .getChild ( 0 ) }
721
+
722
+ override string toString ( ) { result = "sizeof...(<expr>)" }
723
+ }
724
+
725
+ /**
726
+ * A C++11 `sizeof...` expression which determines the size of a template
727
+ * parameter pack and whose operand is an type name or a template template
728
+ * parameter.
729
+ *
730
+ * This expression only appears in templates themselves - in any actual
731
+ * instantiations, "sizeof...(x)" will be replaced by its integer value.
732
+ * ```
733
+ * template < typename... T >
734
+ * int count ( T &&... t ) { return sizeof... ( T ); }
735
+ * ```
736
+ */
737
+ class SizeofPackTypeOperator extends SizeofPackOperator {
738
+ SizeofPackTypeOperator ( ) { sizeof_bind ( underlyingElement ( this ) , _) }
739
+
740
+ override string getAPrimaryQlClass ( ) { result = "SizeofPackTypeOperator" }
741
+
742
+ /** Gets the contained type. */
743
+ Type getTypeOperand ( ) { sizeof_bind ( underlyingElement ( this ) , unresolveElement ( result ) ) }
744
+
745
+ override string toString ( ) { result = "sizeof...(" + this .getTypeOperand ( ) .getName ( ) + ")" }
746
+ }
747
+
706
748
/**
707
749
* A C/C++ sizeof expression.
708
750
*/
0 commit comments