ManualOwnership: provide ability to apply to entire compilation unit

With this patch, I'm flipping the polarity of things.

The flag `-enable-experimental-feature ManualOwnership` now turns on the diagnostics,
but they're all silenced by default. So, you need to add -Wwarning or -Werror to
your build settings to turn on the specific diagnostics you care about.

These are the diagnostic groups relevant to the feature:

- SemanticCopies aka "explicit copies mode"
- DynamicExclusivity

For example, the build setting `-Werror SemanticCopies` now gives you errors about
explicit copies, just as before, but now you can make them just warnings with -Wwarning.

To opt-out a declaration from everything when using the feature, use @_noManualOwnership.

@_manualOwnership is no longer an attribute as a result.

resolves rdar://163372569
This commit is contained in:
Kavon Farvardin
2025-10-24 16:46:42 -07:00
parent 135e02c1d9
commit 2d881bdc9c
13 changed files with 46 additions and 103 deletions

View File

@@ -2145,9 +2145,7 @@ ERROR(attr_static_exclusive_only_mutating,none,
ERROR(attr_static_exclusive_no_setters,none,
"variable of type %0 must not have a setter", (Type))
// @_manualOwnership
ERROR(attr_manual_ownership_experimental,none,
"'@_manualOwnership' requires '-enable-experimental-feature ManualOwnership'", ())
// ManualOwnership
ERROR(attr_manual_ownership_noimplicitcopy,none,
"'@_noImplicitCopy' cannot be used with ManualOwnership", ())