[all-commits] [llvm/llvm-project] c8ba55: Support `guarded_by` attribute and related attribu...

pdherbemont via All-commits all-commits at lists.llvm.org
Tue Jul 9 07:08:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8ba5562e5d1d6942030e1a47762e6e386ff901d
      https://github.com/llvm/llvm-project/commit/c8ba5562e5d1d6942030e1a47762e6e386ff901d
  Author: Pierre d'Herbemont <pdherbemont at apple.com>
  Date:   2024-07-09 (Tue, 09 Jul 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/docs/ThreadSafetyAnalysis.rst
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/Sema/warn-thread-safety-analysis.c
    M clang/test/SemaCXX/warn-thread-safety-analysis.cpp

  Log Message:
  -----------
  Support `guarded_by` attribute and related attributes inside C structs and support late parsing them (#95455)

This fixes #20777. This replaces #94216 which was reverted after being
merged.

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;
};
```



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