<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59094>59094</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            FixItHint: return -> co_return
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hidva
      </td>
    </tr>
</table>

<pre>
    I'm currently doing a refactoring that automatically rewrites `future.then(callback)` to `callback(co_await future)`. After the refactor, there are a lot of `err_return_in_coroutine` errors. Could we add a `FixItHint` to `err_return_in_coroutine`?

I have implemented this `FixItHint` simply now, I am not very familiar with clang, the following patch may seem a bit naive.

```diff
-    Diag(Fn->FirstReturnLoc, diag::err_return_in_coroutine);
+    auto FixItRange = SourceRange(Fn->FirstReturnLoc, getLocForEndOfToken(Fn->FirstReturnLoc, 1));
+    Diag(Fn->FirstReturnLoc, diag::err_return_in_coroutine)
+            << FixItHint::CreateReplacement(FixItRange, "co_return");
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytUl9vmzAQ_zTwcioCHBJ44KFNGi3SpEnd3qMDH8GrwZFtkuXb70zaplXVPQ0ZsH3n3x_fNUZe6l2UrwZoJ2tp9PoC0qjxAAiWOmy9sWHle_SAkzcDetWi5jRLZ6s8OYiWaTf5yVLiexqjvAzxBtvnKK84Bt6ElNtm2Zo9nlF5uB67piVw33myzERvzFG-DmtLgOEFbTyYLqCRtXtLfHrcq3HfGmsmr0YKdBwy1iWwNpOWcOZzUvJZDm3Vn53_pkZ_U_U1TiS2UbqJ0vvrdwc9ngjUcNQ08D2RZGXKfYJ1IeMCozkH8TvAgeceTmQv0OGgtEILZ-V7aDWOhxeH0BmtzTnc9BF928OAF3BEAwtv-KJGVCdK3usJCuchVdddt-6An41CBi23410kHrfKOv802_tu2sAlQ1jc8_jKORdDPLxw5A8BMpQdZpNPrJggEhv4aSbb0rz-B9uBPM-2xj6O8kf3yzzP7fFVdha4P9P_D0fv8V6fSKx5wK16M8jaEnp6oqPGdi50oH7zHgijPOcGvhLx_IPi16LEVGfLZVkVZSlWsayFrESFsVdeU_2eEa44ELzBG2w8WV333h9dEJVveRy4ZaYmac3AC61Pr7-7ozW_qWWZW-XcRI4nRZVWi7ivi1wUhcSlaLOVXKViIUVWZnIlm0Uqloixxoa0q6PigY2MdIYZIpgqNrGq8zTPsyxPs4LzV0maiUwu0zKryq5aiDRapDSg0knQkRh7iG09S2qmg-OgVs67WxCdU4eRaKZjfG6r3ti6V_KE8Uxcz8L_AkycdHU">