[PATCH] D157296: [AST][Coroutine] Fix CoyieldExpr missing end loc
Ding Fei via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 7 10:24:22 PDT 2023
danix800 added inline comments.
================
Comment at: clang/lib/Sema/SemaCoroutine.cpp:321
- return S.BuildCallExpr(nullptr, Result.get(), Loc, Args, Loc, nullptr);
+ auto EndLoc = Args.empty() ? Loc : Args.back()->getBeginLoc();
+ return S.BuildCallExpr(nullptr, Result.get(), Loc, Args, EndLoc, nullptr);
----------------
tbaeder wrote:
> Why `getBeginLoc()` and not `getEndLoc()`?
Aha! Thinko I guess.
Previously I noticed that expr of single ID only tracks its begin loc (end loc == begin loc). So the `getBeginLoc()`.
But for composite expr it's not the case, end loc == last single ID's begin loc.
Here last arg could be a composite expr too and `getEndLoc()` should be used.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157296/new/
https://reviews.llvm.org/D157296
More information about the cfe-commits
mailing list