[all-commits] [llvm/llvm-project] 0c623a: [Clang][OpenMP] Only check value if the expression...

Shilei Tian via All-commits all-commits at lists.llvm.org
Wed Oct 5 05:45:11 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c623ab1bf2eec76d94b79c147983b24d89944be
      https://github.com/llvm/llvm-project/commit/0c623ab1bf2eec76d94b79c147983b24d89944be
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2022-10-05 (Wed, 05 Oct 2022)

  Changed paths:
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/test/OpenMP/atomic_ast_print.cpp

  Log Message:
  -----------
  [Clang][OpenMP] Only check value if the expression is not instantiation dependent

Currently the following case fails:
```
template<typename Ty>
Ty foo(Ty *addr, Ty val) {
  Ty v;
#pragma omp atomic compare capture
  {
    v = *addr;
    if (*addr > val)
      *addr = val;
  }
  return v;
}
```

The compiler complains `addr` is not a lvalue. That's because when an expression
is instantiation dependent, we cannot tell if it is lvalue or not.

Reviewed By: ABataev

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




More information about the All-commits mailing list