This is an archive of the discontinued LLVM Phabricator instance.

Remove use of is_trivially_constructible.
ClosedPublic

Authored by ruiu on May 26 2016, 7:42 PM.

Details

Summary

type_traits header in libstdc++ 4.8 does not define is_trivially_contructible
so the code doesn't compile with it.

In this file we are using the trait for assertion to provide a better
error message. Removing it doesn't change the meaning of the code.

Diff Detail

Event Timeline

ruiu updated this revision to Diff 58745.May 26 2016, 7:42 PM
ruiu retitled this revision from to Remove use of is_trivially_constructible..
ruiu updated this object.
ruiu added a reviewer: zturner.
ruiu added a subscriber: llvm-commits.
majnemer accepted this revision.May 26 2016, 7:51 PM
majnemer added a reviewer: majnemer.
majnemer added a subscriber: majnemer.

LGTM

include/llvm/DebugInfo/CodeView/StreamArray.h
114–115

You could go with std::is_standard_layout<T>::value && std::is_trivial<T>::value to get more or less the same thing.

This revision is now accepted and ready to land.May 26 2016, 7:51 PM
ruiu added inline comments.May 26 2016, 7:53 PM
include/llvm/DebugInfo/CodeView/StreamArray.h
114–115

This seems a bit too tricky to me. It would just fail if you pass non-trivially-constructible class to this one, so I'm okay without this assertion.

This revision was automatically updated to reflect the committed changes.
zturner edited edge metadata.May 26 2016, 10:29 PM
zturner added a subscriber: zturner.

Essentially this code was trying to check "is it safe to reinterpret_cast
sizeof(T) bytes to a T*".

Is there a better way to check that?