[clang] Support [[guarded_by(mutex)]] attribute inside C struct (PR #94216)

Pierre d'Herbemont via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 5 08:34:50 PDT 2024


pdherbemont wrote:

> `-fexperimental-late-parse-attributes`

Done

> > > You may also want to consider making the attribute late parsed in C when `-fexperimental-late-parse-attributes` is enabled. See https://github.com/llvm/llvm-project/pull/93121/files#diff-ae2ec9524bdbeea1f06917607482634dd89af5bcbb929805032463e5dafe79e7R2260
> > > That will allow the code like below:
> > > ```
> > >  struct Foo {
> > >    int a_value GUARDED_BY(mu_); // attribute comes before `mu_` which needs to be late parsed
> > >    struct Mutext *mu_;
> > >  }
> > > ```
> > 
> > 
> > Adopted `LateAttrParseExperimentalExt`. Let me know if that looks okay.
> 
> Thanks! Could you please also add a test taking advantage of late parsing?

Done!

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


More information about the cfe-commits mailing list