Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/google/protobuf/any.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/google/protobuf/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,9 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8)
template <typename T>
PROTOBUF_NDEBUG_INLINE static T* PROTOBUF_NONNULL
CreateArray(Arena* PROTOBUF_NULLABLE arena, size_t num_elements) {
static_assert(std::is_trivially_default_constructible<T>::value,
static_assert(std::is_trivially_default_constructible_v<T>,
"CreateArray requires a trivially constructible type");
static_assert(std::is_trivially_destructible<T>::value,
static_assert(std::is_trivially_destructible_v<T>,
"CreateArray requires a trivially destructible type");
ABSL_CHECK_LE(num_elements,
// Max rounded down to the 8 byte alignment.
Expand Down Expand Up @@ -367,7 +367,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8)
// Collapsing all template instantiations to one for generic Message reduces
// code size, using the virtual destructor instead.
using TypeToUse =
std::conditional_t<std::is_convertible<T*, MessageLite*>::value,
std::conditional_t<std::is_convertible_v<T*, MessageLite*>,
MessageLite, T>;
if (object != nullptr) {
impl_.AddCleanup(static_cast<TypeToUse*>(object),
Expand Down Expand Up @@ -404,7 +404,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8)
// `Arena*`.
template <typename U>
using EnableIfArena =
typename std::enable_if<std::is_same<Arena*, U>::value, Arena*>::type;
std::enable_if_t<std::is_same_v<Arena*, U>, Arena*>;

// Use go/ranked-overloads for dispatching.
struct Rank0 {};
Expand Down Expand Up @@ -469,7 +469,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8)
typedef std::integral_constant<
bool, sizeof(DestructorSkippable<T>(static_cast<const T*>(nullptr))) ==
sizeof(char) ||
std::is_trivially_destructible<T>::value>
std::is_trivially_destructible_v<T>>
is_destructor_skippable;

template <typename U>
Expand Down Expand Up @@ -592,7 +592,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8)

template <typename T, typename... Args>
static constexpr auto GetConstructType() {
return std::is_base_of<MessageLite, T>::value
return std::is_base_of_v<MessageLite, T>
? decltype(ProbeConstructType<T>(std::declval<Args>()...))::value
: ConstructType::kUnknown;
}
Expand Down Expand Up @@ -635,7 +635,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8)
}
}

template <typename T, bool trivial = std::is_trivially_destructible<T>::value>
template <typename T, bool trivial = std::is_trivially_destructible_v<T>>
PROTOBUF_NDEBUG_INLINE void* PROTOBUF_NONNULL AllocateInternal() {
if (trivial) {
return AllocateAligned(sizeof(T), alignof(T));
Expand Down
6 changes: 3 additions & 3 deletions src/google/protobuf/arenastring.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ class PROTOBUF_EXPORT TaggedStringPtr {
void* ptr_;
};

static_assert(std::is_trivially_default_constructible<TaggedStringPtr>::value,
static_assert(std::is_trivially_default_constructible_v<TaggedStringPtr>,
"TaggedStringPtr must be trivially default-constructible");
static_assert(std::is_trivially_destructible<TaggedStringPtr>::value,
static_assert(std::is_trivially_destructible_v<TaggedStringPtr>,
"TaggedStringPtr must be trivially destructible");
static_assert(std::is_standard_layout<TaggedStringPtr>::value,
static_assert(std::is_standard_layout_v<TaggedStringPtr>,
"TaggedStringPtr must be standard layout");

// This class encapsulates a pointer to a std::string with or without arena
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ using proto2_unittest::TestAllTypes;

TEST(MessageConstructorTest, RegularCtor) {
using T = proto2_unittest::TestAllTypes;
EXPECT_TRUE((std::is_constructible<T>::value));
EXPECT_TRUE((std::is_constructible_v<T>));
}

TEST(MessageConstructorTest, RegularCopyCtor) {
using T = proto2_unittest::TestAllTypes;
EXPECT_TRUE((std::is_constructible<T, const T&>::value));
EXPECT_TRUE((std::is_constructible_v<T, const T&>));
}

TEST(MessageConstructorTest, ArenaCtor) {
using T = proto2_unittest::TestAllTypes;
EXPECT_FALSE((std::is_constructible<T, Arena*>::value));
EXPECT_FALSE((std::is_constructible_v<T, Arena*>));
}

TEST(MessageConstructorTest, ArenaCopyCtor) {
using T = proto2_unittest::TestAllTypes;
EXPECT_FALSE((std::is_constructible<T, Arena*, const T&>::value));
EXPECT_FALSE((std::is_constructible_v<T, Arena*, const T&>));
}

} // namespace
Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/compiler/cpp/enum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) {
// directly. Because this includes $Enum$, it must be a callback.
auto write_assert = [&] {
p->Emit(R"cc(
static_assert(::std::is_same<T, $Msg_Enum$>::value ||
::std::is_integral<T>::value,
static_assert(::std::is_same_v<T, $Msg_Enum$> ||
::std::is_integral_v<T>,
"Incorrect type passed to $Enum$_Name().");
)cc");
};
Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/compiler/cpp/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,8 @@ class PROTOC_EXPORT Formatter {

// Convenience overloads to accept different types as arguments.
static std::string ToString(absl::string_view s) { return std::string(s); }
template <typename I, typename = typename std::enable_if<
std::is_integral<I>::value>::type>
template <typename I, typename = std::enable_if_t<
std::is_integral_v<I>>>
static std::string ToString(I x) {
return absl::StrCat(x);
}
Expand Down
16 changes: 8 additions & 8 deletions src/google/protobuf/compiler/cpp/message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1681,8 +1681,8 @@ void MessageGenerator::GenerateImplDefinition(io::Printer* p) {
using InternalArenaConstructable_ = void;
using DestructorSkippable_ = void;
};
static_assert(::std::is_trivially_copy_constructible<Split>::value);
static_assert(::std::is_trivially_destructible<Split>::value);
static_assert(::std::is_trivially_copy_constructible_v<Split>);
static_assert(::std::is_trivially_destructible_v<Split>);
Split* $nonnull$ _split_;
)cc");
}},
Expand Down Expand Up @@ -1820,16 +1820,16 @@ void MessageGenerator::GenerateAnyMethodDefinition(io::Printer* p) {
$nonnull$ value_field);
template <
typename T,
class = typename std::enable_if<!std::is_convertible<
T, const $pb$::Message&>::value>::type>
class = typename std::enable_if_t<!std::is_convertible_v<
T, const $pb$::Message&>>>
bool PackFrom(const T& message) {
return $pbi$::InternalPackFrom<T>(
message, mutable_type_url(), _internal_mutable_value());
}
template <
typename T,
class = typename std::enable_if<!std::is_convertible<
T, const $pb$::Message&>::value>::type>
class = typename std::enable_if_t<!std::is_convertible_v<
T, const $pb$::Message&>>>
bool PackFrom(const T& message,
::absl::string_view type_url_prefix) {
return $pbi$::InternalPackFrom<T>(
Expand All @@ -1838,8 +1838,8 @@ void MessageGenerator::GenerateAnyMethodDefinition(io::Printer* p) {
}
template <
typename T,
class = typename std::enable_if<!std::is_convertible<
T, const $pb$::Message&>::value>::type>
class = typename std::enable_if_t<!std::is_convertible_v<
T, const $pb$::Message&>>>
bool UnpackTo(T* $nonnull$ message) const {
return $pbi$::InternalUnpackTo<T>(
_internal_type_url(), _internal_value(), message);
Expand Down
8 changes: 4 additions & 4 deletions src/google/protobuf/compiler/java/java_features.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/google/protobuf/compiler/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ class PROTOBUF_EXPORT Parser final {

public:
template <typename F,
typename = std::enable_if_t<std::is_same<
std::string, decltype(std::declval<F>()())>::value>>
typename = std::enable_if_t<std::is_same_v<
std::string, decltype(std::declval<F>()())>>>
ErrorMaker(F f) {
static_assert(sizeof(F) <= sizeof(StorageT), "");
static_assert(alignof(F) <= alignof(StorageT), "");
static_assert(std::is_trivially_destructible<F>::value, "");
static_assert(std::is_trivially_destructible_v<F>, "");
::new (static_cast<void*>(storage_)) F(f);
func_ = [](const void* p) { return (*reinterpret_cast<const F*>(p))(); };
}
Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/compiler/plugin.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/cpp_features.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading