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

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 7 10:34:54 PDT 2024


================
@@ -74,6 +83,15 @@ int get_value(int *p) SHARED_LOCKS_REQUIRED(foo_.mu_){
 
 void unlock_scope(struct Mutex *const *mu) __attribute__((release_capability(**mu)));
 
+// Verify late parsing:
+#ifdef LATE_PARSING
+struct LateParsing {
+  int a_value_defined_before GUARDED_BY(a_mutex_defined_late);
+  struct Mutex *a_mutex_defined_late ACQUIRED_AFTER(a_mutex_defined_very_late);
+  struct Mutex *a_mutex_defined_very_late;
----------------
delcypher wrote:

@pdherbemont I think you're missing a use of `pt_guarded_by` and `acquired_before` being late parsed here.

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


More information about the cfe-commits mailing list