[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 19 22:43:29 PDT 2024
tbaederr wrote:
I've resorted to do this in `ThreadSafety.cpp` now, since all other places where we merge function definition and declaration happen before we have the late-parsed attributes available.
>From a diagnostic POV, this seems quite complicated since we have N declarations and need to report differences in M attributes (and each one of them can have >=1 parameter...). For the POC implementation here, I've left if with just reporting a mismatch in attributes. For example with `test/SemaCXX/warn-thread-safety-analysis.cpp`:
```console
error: 'expected-warning' diagnostics seen but not expected:
File /home/tbaeder/code/llvm-project/clang/test/SemaCXX/warn-thread-safety-analysis.cpp Line 2171: attribute mismatch between function definition and declaration of 'foo2'
File /home/tbaeder/code/llvm-project/clang/test/SemaCXX/warn-thread-safety-analysis.cpp Line 2172: attribute mismatch between function definition and declaration of 'foo3'
File /home/tbaeder/code/llvm-project/clang/test/SemaCXX/warn-thread-safety-analysis.cpp Line 2222: attribute mismatch between function definition and declaration of 'fooF2'
File /home/tbaeder/code/llvm-project/clang/test/SemaCXX/warn-thread-safety-analysis.cpp Line 3182: attribute mismatch between function definition and declaration of 'foo1'
File /home/tbaeder/code/llvm-project/clang/test/SemaCXX/warn-thread-safety-analysis.cpp Line 3183: attribute mismatch between function definition and declaration of 'foo2'
File /home/tbaeder/code/llvm-project/clang/test/SemaCXX/warn-thread-safety-analysis.cpp Line 5220: attribute mismatch between function definition and declaration of 'test'
File /home/tbaeder/code/llvm-project/clang/test/SemaCXX/warn-thread-safety-analysis.cpp Line 5221: attribute mismatch between function definition and declaration of 'test2'
```
https://github.com/llvm/llvm-project/pull/67520
More information about the cfe-commits
mailing list