[clang] Traverse attributes in `AttributedStmt`. (PR #117692)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 03:51:48 PST 2024


16bit-ykiko wrote:

A test failed after the modification, but it really confused me
```cpp
// Contexts where there is no function call, no diagnostic.
bool bad();

template <bool>
requires requires { bad(); }
void g() [[clang::nonblocking]] {}

void g() [[clang::nonblocking]] {
    decltype(bad()) a; // doesn't generate a call so, OK
    [[maybe_unused]] auto b = noexcept(bad());
    [[maybe_unused]] auto c = sizeof(bad());
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wassume"
    [[assume(bad())]]; // never evaluated, but maybe still semantically questionable?
#pragma clang diagnostic pop
}
```

```
  File /home/ykiko/C++/clice2/deps/llvm/clang/test/Sema/attr-nonblocking-constraints.cpp Line 396: function with 'nonblocking' attribute must not call non-'nonblocking' function 'bad'
error: 'expected-note' diagnostics seen but not expected: 
  File /home/ykiko/C++/clice2/deps/llvm/clang/test/Sema/attr-nonblocking-constraints.cpp Line 384: declaration cannot be inferred 'nonblocking' because it has no definition in this translation unit
```

I don't know what happened here.

https://github.com/llvm/llvm-project/pull/117692


More information about the cfe-commits mailing list