Skip to content
Merged
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
7 changes: 4 additions & 3 deletions src/google/protobuf/descriptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9796,7 +9796,8 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(

// First set the value on the UnknownFieldSet corresponding to the
// innermost message.
std::unique_ptr<UnknownFieldSet> unknown_fields(new UnknownFieldSet());
std::unique_ptr<UnknownFieldSet> unknown_fields =
std::make_unique<UnknownFieldSet>();
if (!SetOptionValue(field, unknown_fields.get())) {
return false; // SetOptionValue() already added the error.
}
Expand All @@ -9806,8 +9807,8 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption(
for (std::vector<const FieldDescriptor*>::reverse_iterator iter =
intermediate_fields.rbegin();
iter != intermediate_fields.rend(); ++iter) {
std::unique_ptr<UnknownFieldSet> parent_unknown_fields(
new UnknownFieldSet());
std::unique_ptr<UnknownFieldSet> parent_unknown_fields =
std::make_unique<UnknownFieldSet>();
switch ((*iter)->type()) {
case FieldDescriptor::TYPE_MESSAGE: {
std::string outstr;
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/extension_set_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ TEST(ExtensionSetTest, ArenaSetAllocatedMessageAndRelease) {

TEST(ExtensionSetTest, SwapExtensionBothFullWithArena) {
Arena arena1;
std::unique_ptr<Arena> arena2(new Arena());
std::unique_ptr<Arena> arena2 = std::make_unique<Arena>();

unittest::TestAllExtensions* message1 =
Arena::Create<unittest::TestAllExtensions>(&arena1);
Expand Down
9 changes: 6 additions & 3 deletions src/google/protobuf/text_format_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,8 @@ class TextFormatParserTest : public testing::Test {
protected:
void ExpectFailure(const std::string& input, const std::string& message,
int line, int col) {
std::unique_ptr<unittest::TestAllTypes> proto(new unittest::TestAllTypes);
std::unique_ptr<unittest::TestAllTypes> proto =
std::make_unique<unittest::TestAllTypes>();
ExpectFailure(input, message, line, col, proto.get());
}

Expand Down Expand Up @@ -1867,7 +1868,8 @@ class TextFormatParserTest : public testing::Test {
};

TEST_F(TextFormatParserTest, ParseInfoTreeBuilding) {
std::unique_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
std::unique_ptr<unittest::TestAllTypes> message =
std::make_unique<unittest::TestAllTypes>();
const Descriptor* d = message->GetDescriptor();

std::string stringData =
Expand Down Expand Up @@ -1934,7 +1936,8 @@ TEST_F(TextFormatParserTest, ParseInfoTreeBuilding) {
}

TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
std::unique_ptr<unittest::TestAllTypes> message(new unittest::TestAllTypes);
std::unique_ptr<unittest::TestAllTypes> message =
std::make_unique<unittest::TestAllTypes>();
const Descriptor* d = message->GetDescriptor();

#define EXPECT_FIELD(name, value, valuestring) \
Expand Down
Loading