================
@@ -291,6 +292,13 @@ static void ProcessAPINotes(Sema &S, Decl *D,
         });
   }
 
+  // swift_safety
+  if (auto SafetyKind = Info.getSwiftSafety();
+      SafetyKind != api_notes::SwiftSafetyKind::None)
+    D->addAttr(SwiftAttrAttr::Create(
+        S.Context,
+        SafetyKind == api_notes::SwiftSafetyKind::Safe ? "safe" : "unsafe"));
----------------
egorzhdan wrote:

Would this work with versioned API Notes, or when trying to override an 
attribute already specified in the header?

Could you please add a couple of tests:
* a decl in the header is annotated as `safe` or `unsafe`, and the API Notes 
says `unspecified`
* a decl is annotated as `unsafe` pre-Swift 6 and `unspecified` in Swift 6 and 
newer

https://github.com/llvm/llvm-project/pull/157506
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to