hokein added inline comments.

================
Comment at: clang/lib/Sema/SemaCoroutine.cpp:322
+  auto EndLoc = Args.empty() ? Loc : Args.back()->getEndLoc();
+  return S.BuildCallExpr(nullptr, Result.get(), Loc, Args, EndLoc, nullptr);
 }
----------------
Thanks for the fast fix.

Reading the source code here, I'm not sure this is a correct fix (and put the 
heuristic here). I assume the `Loc` points the the `co_yield` token here, 
passing the `Loc` to the `LParenLoc` and `RParenLoc` parameters seems wrong to 
me, there is no `(` and `)` written in the source code here (because the member 
call expression is an implicit generated node in the clang AST), we should pass 
an invalid source location (`SourceLocation()`).

The `CallExpr::getEndLoc()` has implemented similar 
[heuristic](https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/Expr.cpp#L1662-L1664)
 to handle the case where the RParenLoc is invalid.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157296/new/

https://reviews.llvm.org/D157296

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to