[clang] [clang][nullability] allow _Nonnull etc on nullable class types (PR #82705)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 14:35:33 PDT 2024


================
@@ -201,6 +201,21 @@ Attribute Changes in Clang
   and each must be a positive integer when provided. The parameter ``x`` is required, while ``y`` and
   ``z`` are optional with default value of 1.
 
+- The ``_Nullable`` and ``_Nonnull`` family of type attributes can now apply
+  to certain C++ class types, such as smart pointers:
+  ``void useObject(std::unique_ptr<Object> _Nonnull obj);``.
+
+  This works for standard library types including ``unique_ptr``, ``shared_ptr``
+  and ``function``. See `the attribute reference
+documentation <https://llvm.org/docs/AttributeReference.html#nullability-attributes>`_
+for the full list.
----------------
tahonermann wrote:

I'll just fix this with https://github.com/llvm/llvm-project/pull/85310.

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


More information about the cfe-commits mailing list