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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 09:23:54 PDT 2024


================
@@ -671,6 +671,16 @@ void Parser::ParseGNUAttributeArgs(
     ParseBoundsAttribute(*AttrName, AttrNameLoc, Attrs, ScopeName, ScopeLoc,
                          Form);
     return;
+  } else if (AttrKind == ParsedAttr::AT_GuardedBy) {
+    ParseGuardedByAttribute(*AttrName, AttrNameLoc, Attrs, ScopeName, ScopeLoc,
+                            EndLoc,
+                            Form);
+    return;
+  } else if (AttrKind == ParsedAttr::AT_PtGuardedBy) {
+    ParseGuardedByAttribute(*AttrName, AttrNameLoc, Attrs, ScopeName, ScopeLoc,
+                            EndLoc,
+                            Form);
+    return;
----------------
AaronBallman wrote:

```suggestion
  } else if (AttrKind == ParsedAttr::AT_GuardedBy ||
             AttrKind == ParsedAttr::AT_PtGuardedBy) {
    ParseGuardedByAttribute(*AttrName, AttrNameLoc, Attrs, ScopeName, ScopeLoc,
                            EndLoc,
                            Form);
    return;
```

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


More information about the cfe-commits mailing list