Rebase std::is_trivially_* with absl::is_trivially_*
std::is_trivially_* is not available on certain old STL implementations. Using absl implementation will allow maximized compatibility. Bug: webrtc:10054 Change-Id: I17ed0fff44328b3d7c51d14e8c4470f1df0e66ad Reviewed-on: https://webrtc-review.googlesource.com/c/111728 Commit-Queue: Jiawei Ou <ouj@fb.com> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Qingsi Wang <qingsi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25788}
This commit is contained in:
1
DEPS
1
DEPS
@ -1447,6 +1447,7 @@ include_rules = [
|
|||||||
# Abseil whitelist. Keep this in sync with abseil-in-webrtc.md.
|
# Abseil whitelist. Keep this in sync with abseil-in-webrtc.md.
|
||||||
"+absl/container/inlined_vector.h",
|
"+absl/container/inlined_vector.h",
|
||||||
"+absl/memory/memory.h",
|
"+absl/memory/memory.h",
|
||||||
|
"+absl/meta/type_traits.h",
|
||||||
"+absl/strings/ascii.h",
|
"+absl/strings/ascii.h",
|
||||||
"+absl/strings/match.h",
|
"+absl/strings/match.h",
|
||||||
"+absl/strings/string_view.h",
|
"+absl/strings/string_view.h",
|
||||||
|
|||||||
@ -16,6 +16,9 @@ adds the first use.
|
|||||||
* `absl::optional` and related stuff from `absl/types/optional.h`.
|
* `absl::optional` and related stuff from `absl/types/optional.h`.
|
||||||
* `absl::string_view`
|
* `absl::string_view`
|
||||||
* The functions in `absl/strings/ascii.h` and `absl/strings/match.h`
|
* The functions in `absl/strings/ascii.h` and `absl/strings/match.h`
|
||||||
|
* `absl::is_trivially_copy_constructible`,
|
||||||
|
`absl::is_trivially_copy_assignable`, and
|
||||||
|
`absl::is_trivially_destructible` from `absl/meta/type_traits.h`.
|
||||||
* `absl::variant` and related stuff from `absl/types/variant.h`.
|
* `absl::variant` and related stuff from `absl/types/variant.h`.
|
||||||
|
|
||||||
## **Disallowed**
|
## **Disallowed**
|
||||||
|
|||||||
@ -379,6 +379,9 @@ rtc_source_set("sanitizer") {
|
|||||||
sources = [
|
sources = [
|
||||||
"sanitizer.h",
|
"sanitizer.h",
|
||||||
]
|
]
|
||||||
|
deps = [
|
||||||
|
"//third_party/abseil-cpp/absl/meta:type_traits",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_source_set("safe_compare") {
|
rtc_source_set("safe_compare") {
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#include <stddef.h> // For size_t.
|
#include <stddef.h> // For size_t.
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <type_traits>
|
#include "absl/meta/type_traits.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__has_feature)
|
#if defined(__has_feature)
|
||||||
@ -98,10 +98,10 @@ namespace sanitizer_impl {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr bool IsTriviallyCopyable() {
|
constexpr bool IsTriviallyCopyable() {
|
||||||
return static_cast<bool>(std::is_trivially_copy_constructible<T>::value &&
|
return static_cast<bool>(absl::is_trivially_copy_constructible<T>::value &&
|
||||||
(std::is_trivially_copy_assignable<T>::value ||
|
(absl::is_trivially_copy_assignable<T>::value ||
|
||||||
!std::is_copy_assignable<T>::value) &&
|
!std::is_copy_assignable<T>::value) &&
|
||||||
std::is_trivially_destructible<T>::value);
|
absl::is_trivially_destructible<T>::value);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sanitizer_impl
|
} // namespace sanitizer_impl
|
||||||
|
|||||||
Reference in New Issue
Block a user