[llvm-commits] [llvm] r155761 - /llvm/trunk/include/llvm/Support/type_traits.h

John McCall rjmccall at apple.com
Sun Apr 29 03:27:07 PDT 2012


On Apr 28, 2012, at 9:22 AM, Benjamin Kramer wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=155761&view=rev
> Log:
> If the __is_trivially_copyable type trait is available use it as the baseline for isPodLike.
> 
> This way we can enable the POD-like class optimization for a lot more classes,
> saving ~120k of code in clang/i386/Release+Asserts when selfhosting.

SmallVector assumes that isPodLike also implies a trivial destructor
and a valid and trivial copy-assignment operator.  You need to at least
be checking __has_trivial_destructor;  whether you want to also check
__is_trivially_assignable or audit and fix all the places that assume
something about copy assignment is up to you.

For example, SmallVector::push_back is now incorrect (and will fail
to compile) for a class with a reference member.

John.



More information about the llvm-commits mailing list