[all-commits] [llvm/llvm-project] 2ee2b6: [Coroutines] Clear FirstVLALoc in time

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Tue Jun 25 22:37:12 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ee2b6aa7a3d9ba6ba13f6881b25e26d7d12c823
      https://github.com/llvm/llvm-project/commit/2ee2b6aa7a3d9ba6ba13f6881b25e26d7d12c823
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2024-06-26 (Wed, 26 Jun 2024)

  Changed paths:
    M clang/lib/Sema/ScopeInfo.cpp
    M clang/test/SemaCXX/coroutine-vla.cpp

  Log Message:
  -----------
  [Coroutines] Clear FirstVLALoc in time

Unlike other *Loc member in FunctionScopeInfo, we didn't clear
FirstVLALoc in 'FunctionScopeInfo::Clear()'. Then it will be
problematic for the following case:

```
void bar(int n) {
  int array[n];
  return;
}

coroutine foo(int n) {
  co_return;
}
```

When we parse `foo`, the FirstVLALoc is still valid, then the compiler
will report `vla in coroutine` error in bar, which is super odd. After
this patch, we can fix this.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list