Contenuto principale

Cpp.CoAwaitExpression Class

Namespace: Cpp
Superclasses: AstNodeProperties

Represents the co_await_expression nodes in the syntax tree of your code

Since R2026a

Description

The PQL class CoAwaitExpression represents the node co_await_expression in the syntax tree of your code.

#include <coroutine>

struct Awaitable {
    bool await_ready() const noexcept { return true; }
    void await_suspend(std::coroutine_handle<>) const noexcept {}
    int await_resume() const noexcept { return 42; }
};

auto foo() -> std::coroutine_handle<> {
    co_await Awaitable{};       // co_await_expression (argument is an object construction)
    co_await (1 + 2);          // co_await_expression (argument is a parenthesized expression)
    int x = co_await Awaitable{}; // co_await_expression used in initialization
    co_return;
}

The three co_await occurrences in foo() are co_await_expression nodes matched by this PQL class.

Predicates

expand all

Version History

Introduced in R2026a