[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:55 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 Also I can't see any uses of the `LateParsing` struct. It might be worth testing the attributes were parsed. You could do that as a separate AST test or use the `LateParsing` struct in a way that will make the thread safety analysis emit warnings.
https://github.com/llvm/llvm-project/pull/94216
More information about the cfe-commits
mailing list