MsanUninitialized: restric type check to msan case.

This change is needed to avoid undesired failures caused by
IsTriviallyCopyable behavior differences across different compilers and
STL implementations.

It will allow https://webrtc-review.googlesource.com/c/src/+/40300 to
land.

Bug: webrtc:8762
Change-Id: Ide32062605320c706b8a2f3f149d73b967b1fe30
Reviewed-on: https://webrtc-review.googlesource.com/c/110143
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25560}
This commit is contained in:
Alessio Bazzica 2018-11-08 12:20:55 +01:00 committed by Commit Bot
parent c4e9825c04
commit e6c2c0853f

View File

@ -123,9 +123,11 @@ inline void MsanMarkUninitialized(const T& mem) {
template <typename T>
inline T MsanUninitialized(T t) {
#if RTC_HAS_MSAN
// TODO(bugs.webrtc.org/8762): Switch to std::is_trivially_copyable when it
// becomes available in downstream projects.
static_assert(sanitizer_impl::IsTriviallyCopyable<T>(), "");
#endif
rtc_MsanMarkUninitialized(&t, sizeof(T), 1);
return t;
}