================
@@ -8433,6 +8434,44 @@ alternatives, though the attribute can be used even when
the fix can't be automa
Here, every read/write to the fields ptr1, ptr2, buf and sz will trigger a
warning
that the field has been explcitly marked as unsafe due to unsafe-buffer
operations.
+- Attribute attached to container constructors and factory functions: The
+ spellings `[[clang::unsafe_buffer_usage_in_container]]` and
+ `[[clang::unsafe_buffer_usage("container")]]` are equivalent and can be
+ placed on two-parameter constructors and factory functions of container or
+ view types (such as custom span types taking a `(pointer, size)` or
+ `(begin, end)` pair) to opt them in to `-Wunsafe-buffer-usage-in-container`.
+
+ Unlike the general `[[clang::unsafe_buffer_usage]]` attribute, which warns on
+ every call, this form suppresses the warning when the argument pair is
+ provably safeāfor example, when constructing from `c.data(), c.size()` or
----------------
ymand wrote:
nit: i think this should be a double-dash
https://github.com/llvm/llvm-project/pull/227108
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits