<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64483>64483</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
incorrect source range for the CoyieldExpr AST node
</td>
</tr>
<tr>
<th>Labels</th>
<td>
coroutines
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hokein
</td>
</tr>
</table>
<pre>
```
Chat get(int s) {
co_yield s; // incorrect source range, line 69
co_return s;
co_await s;
}
```
The source range of the `CoyieldExpr` only covers the `co_yield` token. This seems to happen on `CoyieldExpr` node only (the other node `CoreturnExpr` and `CoawaitExpr` are fine).
```
|-ExprWithCleanups 0xca71878 <line:69:3> 'void'
| | `-CoyieldExpr 0xca71830 <col:3> 'void'
| | |-CXXMemberCallExpr 0xca714a8 <col:3> 'std::suspend_always':'std::suspend_always'
| | | |-MemberExpr 0xca71478 <col:3> '<bound member function type>' .yield_value 0xca668b0
| | | | `-DeclRefExpr 0xca71458 <col:3> 'std::coroutine_traits<Chat, int>::promise_type':'Chat::promise_type' lvalue Var 0xca6e7e8 '__promise' 'std::coroutine_traits<Chat, int>::promise_type':'Chat::promise_type'
| | | `-ImplicitCastExpr 0xca714d0 <col:12> 'int' <LValueToRValue>
| | | `-DeclRefExpr 0xca6cee8 <col:12> 'int' lvalue ParmVar 0xca6ccc0 's' 'int'
```
See the full example: https://godbolt.org/z/GcKP5r9xn
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VV1v2zYU_TXXL4QNmpT18aAHR4mHYRtQtEHXN4Oiri2uFCmQVJrs1w-k7EztnOypgG0J5LnnnHssXgnv1dkg1rC7g939Skyht67u7VdUZtXa7qWGnF4-9B7ovulFIGcMwEplAvHAKgLFHZl3CZH2-KJQd8QDvyPADsAORBlpnUMZiLeTk0icMGcE1hCtDJK8ulRLe3QYJmdS9YJSfBMqLBahuL_cfO9u_n3s8TshYk8k9Eggp41N7h6eRwc5JdboFyLtEzp_RVwbiNvBfkWzIY-98sQjDp4ES3oxjmiINTf4jO1wJgVWRkIbenTzckLP7V3hwnTzcurvddUhOSmDwKrNsq0fey2adSz5U4W-0SjMNHpCn6UotmVREuBNDBf4Pq-A7znwBwKseLKqA1Zcs4Wimb85XS96ufJwGnmk1f_PkO7WzZcvf-DQomuE1gumTJT_ZfKhA74HvveTH9F0R6G_iRcfyfn-_f1b4snArL5ULm4oA29aO5mODAlOTpORQVlDwsuIwB-AFWST0jg-CT1h4srzsqVvKqcI71Hqj3hayu_ea1xaZ6egDB6DEyp44E08YPFkKBOikQQbnR2Ux2Nyd00nAW9tEz17_ixmEzkWWEbZ4_GCjKCfbuONpHK6_nUYtZIqNMKHZVTd4mnbsktW0UC0y5vfP8e2Hu3HdI2ubiqQm_9ELhHLt-kvkX0QbniNTUpJU0yXuGboO3PnE2KaIqdJa4LPYhh1PH-kD2H0Ka04Dc-2a60OG-vOwA5_Azv8In_7sHPVs5lpVl3Nu4pXYoX1Nq-2vMp2GVv19anaSbajpx12RSZPnGYlO7Uiy_m2rbpttlI1o4zTkha0yCrKNtuCZ1m7bZncCoq7DjKKg1B6o_XTEB2slPcT1nmWlXylRYvap3cBY6_PhAfG4rvB1bFo3U5nDxnVygf_L01QQWN9e86Tk3Upl-WA2X96TGNxNTld_xCQCv3UbqQdgB2iwuWyHp39C2UAdkiuPbBDMv5PAAAA__-4ogNU">