[all-commits] [llvm/llvm-project] 8d60e1: [AST][Coroutine] Fix CoyieldExpr missing end loc

Ding Fei via All-commits all-commits at lists.llvm.org
Wed Aug 9 17:05:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d60e10ce4bd428577ef441eb77b260ec3c14088
      https://github.com/llvm/llvm-project/commit/8d60e10ce4bd428577ef441eb77b260ec3c14088
  Author: dingfei <fding at feysh.com>
  Date:   2023-08-10 (Thu, 10 Aug 2023)

  Changed paths:
    M clang/lib/Sema/SemaCoroutine.cpp
    M clang/test/AST/Inputs/std-coroutine.h
    A clang/test/AST/coroutine-co_yield-source-range.cpp

  Log Message:
  -----------
  [AST][Coroutine] Fix CoyieldExpr missing end loc

Coroutine co_yield/co_await/co_return are implemented by a serious of
synthesized CXXMemberExpr which have no lexical right-side parenthesis.

This fix uses the end loc of inner expr as the hypothetical RParenLoc of
CXXMemberExpr. For tools this might be an issue since the RParen token doesn't
exist (but has a valid location).

For future improvement, we might:
1. mark those inner (generated) exprs as implict (tools have chances to skip
   these nodes) (by @aaron.ballman)
2. borrow the idea from InitListExpr, there are two forms, one is for semantic,
   the other one is for syntactic, having these two split can make everything
   easier (by @hokein)

Fixes https://github.com/llvm/llvm-project/issues/64483

Reviewed By: aaron.ballman, hokein

Differential Revision: https://reviews.llvm.org/D157296




More information about the All-commits mailing list