[libcxx-commits] [PATCH] D82490: [libcxx] Put clang::trivial_abi on std::unique_ptr

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 27 03:17:09 PDT 2020


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

Please add tests for `shared_ptr` and `weak_ptr` too. And for `unique_ptr<T[]>`.



================
Comment at: libcxx/include/__config:109
+// Enable clang::trivial_abi on std::unique_ptr.
+#  ifdef _LIBCPP_ABI_ENABLE_UNIQUE_PTR_WITH_TRIVIAL_ABI
+#    define _LIBCPP_ABI_UNIQUE_PTR_TRIVIAL __attribute__((trivial_abi))
----------------
OK, here's the form I want this to have:

```
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
<existing stuff>
// Enable clang::trivial_abi on std::unique_ptr.
#  define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
// Enable clang::trivial_abi on std::shared_ptr and weak_ptr.
#  define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
...
#endif
```

Then, right above `unique_ptr`:

```
#if defined(_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI)
#  define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI __attribute__((trivial_abi))
#else
#  define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI 
#endif

template <class _Tp, class _Dp = default_delete<_Tp> >
class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS unique_ptr { ... };
```

And do the same for `shared_ptr` and `unique_ptr` with a single macro called `_LIBCPP_SHARED_PTR_TRIVIAL_ABI`.

Please conform to that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82490/new/

https://reviews.llvm.org/D82490





More information about the libcxx-commits mailing list