Merge remote-tracking branch 'upstream/main' into BlockStmt

This commit is contained in:
Jonas Jensen
2020-09-08 14:09:46 +02:00
7 changed files with 4384 additions and 73 deletions

View File

@@ -1268,3 +1268,31 @@ class SpaceshipExpr extends BinaryOperation, @spaceshipexpr {
override string getOperator() { result = "<=>" }
}
/**
* A C/C++ `co_await` expression.
* ```
* co_await foo();
* ```
*/
class CoAwaitExpr extends UnaryOperation, @co_await {
override string getAPrimaryQlClass() { result = "CoAwaitExpr" }
override string getOperator() { result = "co_await" }
override int getPrecedence() { result = 16 }
}
/**
* A C/C++ `co_yield` expression.
* ```
* co_yield 1;
* ```
*/
class CoYieldExpr extends UnaryOperation, @co_yield {
override string getAPrimaryQlClass() { result = "CoYieldExpr" }
override string getOperator() { result = "co_yield" }
override int getPrecedence() { result = 2 }
}

View File

@@ -662,6 +662,67 @@ class LabelStmt extends Stmt, @stmt_label {
override predicate mayBeGloballyImpure() { none() }
}
/**
* A C/C++ `co_return` statement.
*
* For example:
* ```
* co_return 1+2;
* ```
* or
* ```
* co_return;
* ```
*/
class CoReturnStmt extends Stmt, @stmt_co_return {
override string getAPrimaryQlClass() { result = "CoReturnStmt" }
/**
* Gets the operand of this 'co_return' statement.
*
* For example, for
* ```
* co_return 1+2;
* ```
* the operand is a function call `return_value(1+2)`, and for
* ```
* co_return;
* ```
* the operand is a function call `return_void()`.
*/
FunctionCall getOperand() { result = this.getChild(0) }
/**
* Gets the expression of this 'co_return' statement, if any.
*
* For example, for
* ```
* co_return 1+2;
* ```
* the result is `1+2`, and there is no result for
* ```
* co_return;
* ```
*/
Expr getExpr() { result = this.getOperand().getArgument(0) }
/**
* Holds if this 'co_return' statement has an expression.
*
* For example, this holds for
* ```
* co_return 1+2;
* ```
* but not for
* ```
* co_return;
* ```
*/
predicate hasExpr() { exists(this.getExpr()) }
override string toString() { result = "co_return ..." }
}
/**
* A C/C++ 'return' statement.
*

View File

@@ -1228,6 +1228,8 @@ funbind(
| @builtinaddressof
| @vec_fill
| @un_log_op_expr
| @co_await
| @co_yield
;
@bin_log_op_expr = @andlogicalexpr | @orlogicalexpr;
@@ -1647,6 +1649,8 @@ case @expr.kind of
| 324 = @builtinconvertvector
| 325 = @builtincomplex
| 326 = @spaceshipexpr
| 327 = @co_await
| 328 = @co_yield
;
@var_args_expr = @vastartexpr
@@ -1851,6 +1855,7 @@ case @stmt.kind of
| 33 = @stmt_handler
// ... 34 @stmt_finally_end deprecated
| 35 = @stmt_constexpr_if
| 37 = @stmt_co_return
;
type_vla(

View File

@@ -848,6 +848,14 @@
<v>1</v>
</e>
<e>
<k>@co_await</k>
<v>6</v>
</e>
<e>
<k>@co_yield</k>
<v>1</v>
</e>
<e>
<k>@lambdacapture</k>
<v>21652</v>
</e>
@@ -948,6 +956,10 @@
<v>3</v>
</e>
<e>
<k>@stmt_co_return</k>
<v>2</v>
</e>
<e>
<k>@ppd_if</k>
<v>156097</v>
</e>
@@ -1524,7 +1536,7 @@
</e>
<e>
<k>seconds</k>
<v>12239</v>
<v>11965</v>
</e>
</columnsizes>
<dependencies>
@@ -1568,19 +1580,14 @@
<budget>12</budget>
<bs>
<b>
<a>2</a>
<b>3</b>
<v>10</v>
</b>
<b>
<a>3</a>
<b>4</b>
<v>2588</v>
<v>2719</v>
</b>
<b>
<a>4</a>
<b>5</b>
<v>6931</v>
<v>6810</v>
</b>
</bs>
</hist>
@@ -1626,8 +1633,8 @@
<budget>12</budget>
<bs>
<b>
<a>1116</a>
<b>1117</b>
<a>1091</a>
<b>1092</b>
<v>10</v>
</b>
</bs>
@@ -1674,8 +1681,8 @@
<budget>12</budget>
<bs>
<b>
<a>6</a>
<b>7</b>
<a>7</a>
<b>8</b>
<v>10</v>
</b>
<b>
@@ -1684,13 +1691,13 @@
<v>10</v>
</b>
<b>
<a>574</a>
<b>575</b>
<a>572</a>
<b>573</b>
<v>10</v>
</b>
<b>
<a>681</a>
<b>682</b>
<a>666</a>
<b>667</b>
<v>10</v>
</b>
</bs>
@@ -1707,22 +1714,22 @@
<b>
<a>1</a>
<b>2</b>
<v>7907</v>
<v>7863</v>
</b>
<b>
<a>2</a>
<b>3</b>
<v>2665</v>
<v>2237</v>
</b>
<b>
<a>3</a>
<b>4</b>
<v>965</v>
<v>1107</v>
</b>
<b>
<a>4</a>
<b>621</b>
<v>701</v>
<b>641</b>
<v>756</v>
</b>
</bs>
</hist>
@@ -1738,7 +1745,7 @@
<b>
<a>1</a>
<b>2</b>
<v>12239</v>
<v>11965</v>
</b>
</bs>
</hist>
@@ -1754,17 +1761,17 @@
<b>
<a>1</a>
<b>2</b>
<v>10528</v>
<v>10144</v>
</b>
<b>
<a>2</a>
<b>3</b>
<v>1688</v>
<v>1809</v>
</b>
<b>
<a>3</a>
<b>4</b>
<v>21</v>
<v>10</v>
</b>
</bs>
</hist>
@@ -2143,11 +2150,11 @@
</e>
<e>
<k>cpu_seconds</k>
<v>8203</v>
<v>8159</v>
</e>
<e>
<k>elapsed_seconds</k>
<v>186</v>
<v>197</v>
</e>
</columnsizes>
<dependencies>
@@ -2193,17 +2200,17 @@
<b>
<a>1</a>
<b>2</b>
<v>7161</v>
<v>7106</v>
</b>
<b>
<a>2</a>
<b>3</b>
<v>800</v>
<v>833</v>
</b>
<b>
<a>3</a>
<b>5</b>
<v>241</v>
<b>7</b>
<v>219</v>
</b>
</bs>
</hist>
@@ -2219,12 +2226,12 @@
<b>
<a>1</a>
<b>2</b>
<v>7764</v>
<v>7677</v>
</b>
<b>
<a>2</a>
<b>3</b>
<v>438</v>
<v>482</v>
</b>
</bs>
</hist>
@@ -2240,12 +2247,12 @@
<b>
<a>1</a>
<b>2</b>
<v>32</v>
<v>43</v>
</b>
<b>
<a>2</a>
<b>3</b>
<v>32</v>
<v>21</v>
</b>
<b>
<a>4</a>
@@ -2253,8 +2260,13 @@
<v>10</v>
</b>
<b>
<a>7</a>
<b>8</b>
<a>6</a>
<b>7</b>
<v>10</v>
</b>
<b>
<a>9</a>
<b>10</b>
<v>10</v>
</b>
<b>
@@ -2263,43 +2275,43 @@
<v>10</v>
</b>
<b>
<a>18</a>
<b>19</b>
<a>13</a>
<b>14</b>
<v>10</v>
</b>
<b>
<a>26</a>
<b>27</b>
<a>31</a>
<b>32</b>
<v>10</v>
</b>
<b>
<a>29</a>
<b>30</b>
<a>32</a>
<b>33</b>
<v>10</v>
</b>
<b>
<a>108</a>
<b>109</b>
<a>99</a>
<b>100</b>
<v>10</v>
</b>
<b>
<a>126</a>
<b>127</b>
<a>106</a>
<b>107</b>
<v>10</v>
</b>
<b>
<a>151</a>
<b>152</b>
<a>149</a>
<b>150</b>
<v>10</v>
</b>
<b>
<a>162</a>
<b>163</b>
<a>191</a>
<b>192</b>
<v>10</v>
</b>
<b>
<a>219</a>
<b>220</b>
<a>211</a>
<b>212</b>
<v>10</v>
</b>
</bs>
@@ -2316,12 +2328,12 @@
<b>
<a>1</a>
<b>2</b>
<v>32</v>
<v>43</v>
</b>
<b>
<a>2</a>
<b>3</b>
<v>32</v>
<v>21</v>
</b>
<b>
<a>4</a>
@@ -2329,8 +2341,13 @@
<v>10</v>
</b>
<b>
<a>7</a>
<b>8</b>
<a>6</a>
<b>7</b>
<v>10</v>
</b>
<b>
<a>9</a>
<b>10</b>
<v>10</v>
</b>
<b>
@@ -2339,43 +2356,43 @@
<v>10</v>
</b>
<b>
<a>17</a>
<b>18</b>
<a>13</a>
<b>14</b>
<v>10</v>
</b>
<b>
<a>26</a>
<b>27</b>
<a>31</a>
<b>32</b>
<v>10</v>
</b>
<b>
<a>29</a>
<b>30</b>
<a>32</a>
<b>33</b>
<v>10</v>
</b>
<b>
<a>86</a>
<b>87</b>
<a>87</a>
<b>88</b>
<v>10</v>
</b>
<b>
<a>119</a>
<b>120</b>
<a>90</a>
<b>91</b>
<v>10</v>
</b>
<b>
<a>130</a>
<b>131</b>
<a>138</a>
<b>139</b>
<v>10</v>
</b>
<b>
<a>139</a>
<b>140</b>
<a>178</a>
<b>179</b>
<v>10</v>
</b>
<b>
<a>210</a>
<b>211</b>
<a>180</a>
<b>181</b>
<v>10</v>
</b>
</bs>