diff options
author | Pierre d'Herbemont <pdherbemont@gmail.com> | 2024-06-12 20:20:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 11:20:05 -0700 |
commit | af0d7128c8fd053d3de8af208d7d1682bc7a525a (patch) | |
tree | 221a1e0e7302f1b4a2e82fd452c96f6263f68659 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 7665d3d90da7f32e56cb57eb192dc8f189730686 (diff) | |
download | llvm-af0d7128c8fd053d3de8af208d7d1682bc7a525a.zip llvm-af0d7128c8fd053d3de8af208d7d1682bc7a525a.tar.gz llvm-af0d7128c8fd053d3de8af208d7d1682bc7a525a.tar.bz2 |
Support `guarded_by` attribute and related attributes inside C structs and support late parsing them (#94216)
This fixes #20777.
Previously the `guarded_by`, `pt_guarded_by`, `acquired_after`, and `acquired_before` attributes were only supported inside C++ classes or top level C/C++ declaration.
This patch allows these attributes to be added to struct members in C. These attributes have also now support experimental late parsing. This is off by default but can be enabled by passing `-fexperimental-late-parse-attributes`. This is useful for referring to a struct member after the annotated member. E.g.
```
struct Example {
int a_value_defined_before __attribute__ ((guarded_by(a_mutex)));
struct Mutex *a_mutex;
};
```
Patch by Pierre d'Herbemont (@pdherbemont)
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions