[PATCH] D93497: Salvage debug info for function arguments in coro-split funclets.

Yifeng Dong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 10 21:39:51 PST 2021


dongAxis1944 added a comment.

  // clang++ -fcoroutines-ts  -std=c++2a coro-debug-1.cpp  -O0 -g -o e2.out
  struct test {
      int i;
      int j;
      double k;
  };
  
  struct coro {
    ...
  };
  
  coro foo(struct test & t) {
    int i = 0;
    int j = 0;
    i = t.i + t.j + t.k;
    printf("%d\n", i);
  
    co_await suspend_always();
    printf("%d, %d, %d\n", i, j, t.i); // --> A
  
    co_await suspend_always();
    ++i;
    ++j;
    printf("%d, %d, %d\n", j, i, t.k); 
  
    co_await suspend_always();
    printf("%d \n", j);
  }
  
  int main(int argc, char *argv[]) {
    struct test t = {0xee,0xff, 1.0};
    auto c = foo(t);
    c.handle.resume();
    c.handle.resume();
    c.handle.resume();
  }



In D93497#2488090 <https://reviews.llvm.org/D93497#2488090>, @aprantl wrote:

>> I think the patch might occur an error when compilling the following code (commit id of clang is 9d70dbdc2bf294abffd4b2c9ae524055f72d017a <https://reviews.llvm.org/rG9d70dbdc2bf294abffd4b2c9ae524055f72d017a>).
>
> Could you give me a standalone example so I can reproduce this? I wrote this patch with Swift coroutines in mind and am not familiar enough with C++ coroutines to turn your example into something I can compile yet. Either source code or LLVM IR that I can pipe into `opt` would be fine.
>
> thanks!
> adrian




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

https://reviews.llvm.org/D93497



More information about the llvm-commits mailing list