@@ -8,6 +8,22 @@ abstract class BuiltInOperation extends Expr {
88 override string getCanonicalQLClass ( ) { result = "BuiltInOperation" }
99}
1010
11+ /**
12+ * A C/C++ built-in operation that is used to support functions with variable numbers of arguments.
13+ * This includes `va_start`, `va_end`, `va_copy`, and `va_arg`.
14+ */
15+ class VarArgsExpr extends BuiltInOperation {
16+ VarArgsExpr ( ) {
17+ this instanceof BuiltInVarArgsStart
18+ or
19+ this instanceof BuiltInVarArgsEnd
20+ or
21+ this instanceof BuiltInVarArg
22+ or
23+ this instanceof BuiltInVarArgCopy
24+ }
25+ }
26+
1127/**
1228 * A C/C++ `__builtin_va_start` built-in operation (used by some
1329 * implementations of `va_start`).
@@ -20,6 +36,16 @@ class BuiltInVarArgsStart extends BuiltInOperation, @vastartexpr {
2036 override string toString ( ) { result = "__builtin_va_start" }
2137
2238 override string getCanonicalQLClass ( ) { result = "BuiltInVarArgsStart" }
39+
40+ /**
41+ * Gets the `va_list` argument.
42+ */
43+ final Expr getVAList ( ) { result = getChild ( 0 ) }
44+
45+ /**
46+ * Gets the argument that specifies the last named parameter before the ellipsis.
47+ */
48+ final VariableAccess getLastNamedParameter ( ) { result = getChild ( 1 ) }
2349}
2450
2551/**
@@ -35,6 +61,11 @@ class BuiltInVarArgsEnd extends BuiltInOperation, @vaendexpr {
3561 override string toString ( ) { result = "__builtin_va_end" }
3662
3763 override string getCanonicalQLClass ( ) { result = "BuiltInVarArgsEnd" }
64+
65+ /**
66+ * Gets the `va_list` argument.
67+ */
68+ final Expr getVAList ( ) { result = getChild ( 0 ) }
3869}
3970
4071/**
@@ -48,6 +79,11 @@ class BuiltInVarArg extends BuiltInOperation, @vaargexpr {
4879 override string toString ( ) { result = "__builtin_va_arg" }
4980
5081 override string getCanonicalQLClass ( ) { result = "BuiltInVarArg" }
82+
83+ /**
84+ * Gets the `va_list` argument.
85+ */
86+ final Expr getVAList ( ) { result = getChild ( 0 ) }
5187}
5288
5389/**
@@ -63,6 +99,16 @@ class BuiltInVarArgCopy extends BuiltInOperation, @vacopyexpr {
6399 override string toString ( ) { result = "__builtin_va_copy" }
64100
65101 override string getCanonicalQLClass ( ) { result = "BuiltInVarArgCopy" }
102+
103+ /**
104+ * Gets the destination `va_list` argument.
105+ */
106+ final Expr getDestinationVAList ( ) { result = getChild ( 0 ) }
107+
108+ /**
109+ * Gets the the source `va_list` argument.
110+ */
111+ final Expr getSourceVAList ( ) { result = getChild ( 1 ) }
66112}
67113
68114/**
0 commit comments