Unverified Commit af0d7128 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont Committed by GitHub
Browse files

Support `guarded_by` attribute and related attributes inside C structs and...

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)
parent 7665d3d9
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment