[PATCH] D57097: Make llvm::Optional<T> trivially copyable when T is trivially copyable

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 23 06:12:52 PST 2019


serge-sans-paille created this revision.
serge-sans-paille added reviewers: bkramer, EricWF.
Herald added subscribers: kristina, dexonsmith.

This is an ever-recurring issue (see https://bugs.llvm.org/show_bug.cgi?id=39427 and https://bugs.llvm.org/show_bug.cgi?id=35978) but I believe that thanks to https://reviews.llvm.org/D54472 we can now ship a decent implementation of this.

Basically the fact that llvm::is_trivially_copyable has a consistent behavior across compilers should prevent any ABI issue, and using in-place new instead of memcpy should keep compiler bugs away.


Repository:
  rL LLVM

https://reviews.llvm.org/D57097

Files:
  include/llvm/ADT/Optional.h
  unittests/ADT/OptionalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57097.183094.patch
Type: text/x-patch
Size: 3175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190123/76b0a740/attachment.bin>


More information about the llvm-commits mailing list