[all-commits] [llvm/llvm-project] af0d71: Support `guarded_by` attribute and related attribu...
pdherbemont via All-commits
all-commits at lists.llvm.org
Wed Jun 12 11:20:27 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: af0d7128c8fd053d3de8af208d7d1682bc7a525a
https://github.com/llvm/llvm-project/commit/af0d7128c8fd053d3de8af208d7d1682bc7a525a
Author: Pierre d'Herbemont <pdherbemont at gmail.com>
Date: 2024-06-12 (Wed, 12 Jun 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/docs/ThreadSafetyAnalysis.rst
M clang/include/clang/Basic/Attr.td
M clang/include/clang/Parse/Parser.h
M clang/include/clang/Sema/Sema.h
M clang/lib/Parse/ParseDecl.cpp
M clang/lib/Sema/SemaExpr.cpp
M clang/test/AST/ast-dump-color.cpp
M clang/test/Sema/warn-thread-safety-analysis.c
M clang/test/SemaCXX/warn-thread-safety-parsing.cpp
Log Message:
-----------
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)
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list