Skip to content

Commit 8383bc1

Browse files
committed
C++: Add getters for the other children of 'co_return' and 'co_yield'.
1 parent 35d1a92 commit 8383bc1

File tree

1 file changed

+36
-0
lines changed
  • cpp/ql/lib/semmle/code/cpp/exprs

1 file changed

+36
-0
lines changed

cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,24 @@ class CoAwaitExpr extends UnaryOperation, @co_await {
13381338
override string getOperator() { result = "co_await" }
13391339

13401340
override int getPrecedence() { result = 16 }
1341+
1342+
/**
1343+
* Gets the Boolean expression that is used to decide if the enclosing
1344+
* coroutine should be suspended.
1345+
*/
1346+
Expr getAwaitReady() { result = this.getChild(1) }
1347+
1348+
/**
1349+
* Gets the expression that represents the resume point if the enclosing
1350+
* coroutine was suspended.
1351+
*/
1352+
Expr getAwaitResume() { result = this.getChild(2) }
1353+
1354+
/**
1355+
* Gets the expression that is evaluated when the enclosing coroutine is
1356+
* suspended.
1357+
*/
1358+
Expr getAwaitSuspend() { result = this.getChild(3) }
13411359
}
13421360

13431361
/**
@@ -1352,6 +1370,24 @@ class CoYieldExpr extends UnaryOperation, @co_yield {
13521370
override string getOperator() { result = "co_yield" }
13531371

13541372
override int getPrecedence() { result = 2 }
1373+
1374+
/**
1375+
* Gets the Boolean expression that is used to decide if the enclosing
1376+
* coroutine should be suspended.
1377+
*/
1378+
Expr getAwaitReady() { result = this.getChild(1) }
1379+
1380+
/**
1381+
* Gets the expression that represents the resume point if the enclosing
1382+
* coroutine was suspended.
1383+
*/
1384+
Expr getAwaitResume() { result = this.getChild(2) }
1385+
1386+
/**
1387+
* Gets the expression that is evaluated when the enclosing coroutine is
1388+
* suspended.
1389+
*/
1390+
Expr getAwaitSuspend() { result = this.getChild(3) }
13551391
}
13561392

13571393
/**

0 commit comments

Comments
 (0)