mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C++: Split CoReturnStmt.getExpr into CoReturnStmt.{getOperand,getExpr}
This commit is contained in:
@@ -678,7 +678,22 @@ class CoReturnStmt extends Stmt, @stmt_co_return {
|
||||
override string getAPrimaryQlClass() { result = "CoReturnStmt" }
|
||||
|
||||
/**
|
||||
* Gets the expression of this 'co_return' statement.
|
||||
* 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
|
||||
* ```
|
||||
@@ -688,10 +703,8 @@ class CoReturnStmt extends Stmt, @stmt_co_return {
|
||||
* ```
|
||||
* co_return;
|
||||
* ```
|
||||
*
|
||||
* TODO: Really?
|
||||
*/
|
||||
Expr getExpr() { result = this.getChild(0) }
|
||||
Expr getExpr() { result = this.getOperand().getArgument(0) }
|
||||
|
||||
/**
|
||||
* Holds if this 'co_return' statement has an expression.
|
||||
|
||||
Reference in New Issue
Block a user