Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–28 unchanged (28 lines)
29#include "absl/strings/string_view.h"
30#include "absl/types/optional.h"
31#include "absl/types/span.h"
32#include "google/protobuf/arena_test_util.h"
33#include "google/protobuf/io/coded_stream.h"
34#include "google/protobuf/message.h"
35#include "google/protobuf/unittest.pb.h"
36#include "google/protobuf/unittest_import.pb.h"
37
38
39// Must be included last.
40#include "google/protobuf/port_def.inc"
41
…lines 42–1092 unchanged (1051 lines)
1093 const std::string* const* data = field->data();
1094 *field = std::move(*field);
1095 EXPECT_EQ(data, field->data());
1096 EXPECT_THAT(*field, ElementsAre("1", "2"));
1097 }
1098}
1099
1100TEST_F(RepeatedPtrFieldTest, MutableDataIsMutable) {
1101 RepeatedPtrField<std::string> field;
1102 *field.Add() = "1";
1103 EXPECT_EQ("1", field.Get(0));
1104 // The fact that this line compiles would be enough, but we'll check the
1105 // value anyway.
…lines 1106–1802 unchanged (697 lines)

After

…lines 1–28 unchanged (28 lines)
29#include "absl/strings/string_view.h"
30#include "absl/types/optional.h"
31#include "absl/types/span.h"
32#include "google/protobuf/arena_test_util.h"
33#include "google/protobuf/io/coded_stream.h"
34#include "google/protobuf/message.h"
35#include "google/protobuf/message_lite.h"
36#include "google/protobuf/unittest.pb.h"
37#include "google/protobuf/unittest_import.pb.h"
38
39
40// Must be included last.
41#include "google/protobuf/port_def.inc"
…lines 42–1094 unchanged (1053 lines)
1095 *field = std::move(*field);
1096 EXPECT_EQ(data, field->data());
1097 EXPECT_THAT(*field, ElementsAre("1", "2"));
1098 }
1099}
1100
1101TEST_F(RepeatedPtrFieldTest, Resize) {
1102 RepeatedPtrField<std::string> rep;
1103
1104 EXPECT_THAT(rep, ElementsAre());
1105
1106 rep.resize(3);
1107 EXPECT_THAT(rep, ElementsAre("", "", ""));
1108
1109 rep.resize(2);
1110 EXPECT_THAT(rep, ElementsAre("", ""));
1111
1112 rep.resize(4, "foo");
1113 EXPECT_THAT(rep, ElementsAre("", "", "foo", "foo"));
1114
1115 rep.resize(3, "bar");
1116 EXPECT_THAT(rep, ElementsAre("", "", "foo"));
1117}
1118
1119TEST_F(RepeatedPtrFieldTest, ResizeMessage) {
1120 using T = TestAllTypes::NestedMessage;
1121
1122 T msg;
1123 msg.set_bb(1);
1124
1125 RepeatedPtrField<T> rep;
1126 rep.resize(2, msg);
1127 rep.resize(3);
1128
1129 ASSERT_EQ(rep.size(), 3);
1130 EXPECT_EQ(rep[0].bb(), 1);
1131 EXPECT_EQ(rep[1].bb(), 1);
1132 EXPECT_EQ(rep[2].bb(), 0);
1133}
1134
1135TEST_F(RepeatedPtrFieldTest, ResizeMessageWithBaseClass) {
1136 using T = TestAllTypes::NestedMessage;
1137
1138 T msg;
1139 msg.set_bb(1);
1140
1141 RepeatedPtrField<MessageLite> rep;
1142 rep.resize(2, msg);
1143 msg.set_bb(2);
1144 rep.resize(3, msg);
1145
1146 ASSERT_EQ(rep.size(), 3);
1147 EXPECT_EQ(DownCastMessage<T>(rep[0]).bb(), 1);
1148 EXPECT_EQ(DownCastMessage<T>(rep[1]).bb(), 1);
1149 EXPECT_EQ(DownCastMessage<T>(rep[2]).bb(), 2);
1150}
1151
1152TEST_F(RepeatedPtrFieldTest, ResizeWithArenas) {
1153 Arena arena;
1154 auto& strs = *Arena::Create<RepeatedPtrField<std::string>>(&arena);
1155 strs.resize(2, "Very long string to avoid SSO in the string.");
1156 strs.resize(1);
1157 EXPECT_THAT(strs,
1158 ElementsAre("Very long string to avoid SSO in the string."));
1159
1160 TestAllTypes msg_no_arena;
1161 msg_no_arena.mutable_optional_nested_message();
1162 auto& msgs = *Arena::Create<RepeatedPtrField<TestAllTypes>>(&arena);
1163 msgs.resize(2, msg_no_arena);
1164 msgs.resize(1);
1165 msgs.resize(2);
1166
1167 ASSERT_EQ(msgs.size(), 2);
1168 EXPECT_TRUE(msgs[0].has_optional_nested_message());
1169 EXPECT_FALSE(msgs[1].has_optional_nested_message());
1170}
1171
1172TEST_F(RepeatedPtrFieldTest, MutableDataIsMutable) {
1173 RepeatedPtrField<std::string> field;
1174 *field.Add() = "1";
1175 EXPECT_EQ("1", field.Get(0));
1176 // The fact that this line compiles would be enough, but we'll check the
…lines 1177–1874 unchanged (698 lines)

Before

translation_unit
comment "// Protocol Buffers - Google's data interchange format"
comment "// Copyright 2008, 2024 Google Inc. All rights reserved."
comment "//"
comment "// Use of this source code is governed by a BSD-style"
comment "// license that can be found in the LICENSE file or at"
comment "// https://developers.google.com/open-source/licenses/bsd"
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/repeated_ptr_field.h"
" "\""
preproc_include
#include "#include"
system_lib_string "<algorithm>"
preproc_include
#include "#include"
system_lib_string "<cstddef>"
preproc_include
#include "#include"
system_lib_string "<cstdint>"
preproc_include
#include "#include"
system_lib_string "<cstdlib>"
preproc_include
#include "#include"
system_lib_string "<cstring>"
preproc_include
#include "#include"
system_lib_string "<functional>"
preproc_include
#include "#include"
system_lib_string "<iterator>"
preproc_include
#include "#include"
system_lib_string "<list>"
preproc_include
#include "#include"
system_lib_string "<memory>"
preproc_include
#include "#include"
system_lib_string "<string>"
preproc_include
#include "#include"
system_lib_string "<type_traits>"
preproc_include
#include "#include"
system_lib_string "<utility>"
preproc_include
#include "#include"
system_lib_string "<vector>"
preproc_include
#include "#include"
system_lib_string "<gmock/gmock.h>"
preproc_include
#include "#include"
system_lib_string "<gtest/gtest.h>"
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/log/absl_check.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/numeric/bits.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/strings/str_cat.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/strings/string_view.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/types/optional.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/types/span.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/arena_test_util.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/io/coded_stream.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/message.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/unittest.pb.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/unittest_import.pb.h"
" "\""
comment "// Must be included last."
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/port_def.inc"
" "\""
namespace_definition
namespace "namespace"
namespace_identifier "google"
declaration_list
{ "{"
namespace_definition
namespace "namespace"
namespace_identifier "protobuf"
declaration_list
{ "{"
namespace_definition
namespace "namespace"
namespace_identifier "internal"
declaration_list
{ "{"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "proto2_unittest"
:: "::"
identifier "TestAllTypes"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "proto2_unittest"
:: "::"
identifier "TestMessageWithManyRepeatedPtrFields"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "A"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "AllOf"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "ElementsAre"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "Ge"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "Le"
; ";"
alias_declaration
using "using"
type_identifier "String"
= "="
type_descriptor
qualified_identifier
namespace_identifier "std"
:: "::"
type_identifier "string"
; ";"
alias_declaration
using "using"
type_identifier "SmallMsg"
= "="
type_descriptor
qualified_identifier
namespace_identifier "proto2_unittest"
:: "::"
type_identifier "ForeignMessage"
; ";"
alias_declaration
using "using"
type_identifier "LargeMsg"
= "="
type_descriptor
qualified_identifier
namespace_identifier "proto2_unittest"
:: "::"
type_identifier "TestAllTypes"
; ";"
namespace_definition (+55 nodes collapsed)
comment "// namespace"
class_specifier (+59 nodes collapsed)
; ";"
function_definition (+272 nodes collapsed)
preproc_ifdef (+173 nodes collapsed)
function_definition (+282 nodes collapsed)
function_definition (+252 nodes collapsed)
function_definition (+267 nodes collapsed)
function_definition (+100 nodes collapsed)
function_definition (+51 nodes collapsed)
function_definition (+180 nodes collapsed)
comment "// This helper overload set tests whether X::f can be called"...
comment "// X::f({a, b}) of std::string iterators (specifically, poin"...
comment "// ambiguous if and only if the call to ValidResolutionPoint"...
template_declaration (+61 nodes collapsed)
template_declaration (+23 nodes collapsed)
function_definition (+247 nodes collapsed)
function_definition (+555 nodes collapsed)
function_definition (+198 nodes collapsed)
namespace_definition (+339 nodes collapsed)
comment "// namespace"
function_definition (+56 nodes collapsed)
function_definition (+330 nodes collapsed)
function_definition (+406 nodes collapsed)
function_definition (+356 nodes collapsed)
function_definition (+290 nodes collapsed)
function_definition (+390 nodes collapsed)
function_definition (+96 nodes collapsed)
function_definition (+55 nodes collapsed)
function_definition (+93 nodes collapsed)
function_definition (+108 nodes collapsed)
function_definition (+87 nodes collapsed)
comment "// TODO: Re-evaluate if this is still needed once the bug is"...
function_definition (+329 nodes collapsed)
comment "// Test all code paths in AddAllocated()."
function_definition (+587 nodes collapsed)
function_definition (+82 nodes collapsed)
function_definition (+65 nodes collapsed)
comment "// This test replicates a very specific scenario that used t"...
comment "// hard-to-debug failure in protoc during development."
function_definition (+316 nodes collapsed)
function_definition (+505 nodes collapsed)
function_definition (+534 nodes collapsed)
function_definition (+324 nodes collapsed)
function_definition (+329 nodes collapsed)
function_definition (+204 nodes collapsed)
function_definition (+97 nodes collapsed)
function_definition (+582 nodes collapsed)
function_definition (+249 nodes collapsed)
function_definition (+171 nodes collapsed)
function_definition (+266 nodes collapsed)
function_definition (+359 nodes collapsed)
function_definition (+488 nodes collapsed)
function_definition (+199 nodes collapsed)
function_definition (+149 nodes collapsed)
function_definition (+352 nodes collapsed)
function_definition (+1354 nodes collapsed)
function_definition (+123 nodes collapsed)
function_definition (+155 nodes collapsed)
function_definition (+715 nodes collapsed)
function_definition
function_declarator
identifier "TEST_F"
parameter_list
( "("
parameter_declaration
type_identifier "RepeatedPtrFieldTest"
, ","
parameter_declaration
type_identifier "DeleteSubrange"
) ")"
compound_statement
{ "{"
comment "// DeleteSubrange is a trivial extension of ExtendSubrange."
} "}"
function_definition (+174 nodes collapsed)
function_definition (+169 nodes collapsed)
function_definition (+171 nodes collapsed)
comment "// ========================================================="...
class_specifier (+105 nodes collapsed)
; ";"
function_definition (+93 nodes collapsed)
function_definition (+145 nodes collapsed)
function_definition (+178 nodes collapsed)
function_definition (+145 nodes collapsed)
function_definition (+165 nodes collapsed)
function_definition (+163 nodes collapsed)
function_definition (+163 nodes collapsed)
function_definition (+68 nodes collapsed)
function_definition (+150 nodes collapsed)
function_definition (+197 nodes collapsed)
comment "// Uninitialized iterator does not point to any of the Repea"...
function_definition (+129 nodes collapsed)
function_definition (+265 nodes collapsed)
function_definition (+72 nodes collapsed)
comment "// ---------------------------------------------------------"...
class_specifier (+130 nodes collapsed)
; ";"
function_definition (+54 nodes collapsed)
function_definition (+54 nodes collapsed)
function_definition (+153 nodes collapsed)
function_definition (+153 nodes collapsed)
function_definition (+167 nodes collapsed)
function_definition (+167 nodes collapsed)
function_definition (+68 nodes collapsed)
function_definition (+150 nodes collapsed)
function_definition (+150 nodes collapsed)
function_definition (+197 nodes collapsed)
comment "// Uninitialized iterator does not point to any of the Repea"...
comment "// Dereferencing an uninitialized iterator crashes the proce"...
function_definition (+129 nodes collapsed)
function_definition (+129 nodes collapsed)
comment "// This comparison functor is required by the tests for Repe"...
comment "// They operate on strings and need to compare strings as st"...
comment "// any stl algorithm, even though the iterator returns a poi"...
comment "// string"
comment "// - i.e. *iter has type std::string*."
struct_specifier (+52 nodes collapsed)
; ";"
function_definition (+412 nodes collapsed)
function_definition (+222 nodes collapsed)
function_definition (+320 nodes collapsed)
comment "// ---------------------------------------------------------"...
comment "// Unit-tests for the insert iterators"
comment "// `google::protobuf::RepeatedPtrFieldBackInserter`,"
comment "// `google::protobuf::AllocatedRepeatedPtrFieldBackInserter`"
comment "// Ported from util/gtl/proto-array-iterators_unittest."
class_specifier (+426 nodes collapsed)
; ";"
function_definition (+93 nodes collapsed)
function_definition (+245 nodes collapsed)
function_definition (+131 nodes collapsed)
function_definition (+181 nodes collapsed)
function_definition (+210 nodes collapsed)
function_definition (+211 nodes collapsed)
function_definition (+224 nodes collapsed)
function_definition (+144 nodes collapsed)
function_definition (+244 nodes collapsed)
} "}"
comment "// namespace internal"
} "}"
comment "// namespace protobuf"
} "}"
comment "// namespace google"
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/port_undef.inc"
" "\""

After

translation_unit
comment "// Protocol Buffers - Google's data interchange format"
comment "// Copyright 2008, 2024 Google Inc. All rights reserved."
comment "//"
comment "// Use of this source code is governed by a BSD-style"
comment "// license that can be found in the LICENSE file or at"
comment "// https://developers.google.com/open-source/licenses/bsd"
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/repeated_ptr_field.h"
" "\""
preproc_include
#include "#include"
system_lib_string "<algorithm>"
preproc_include
#include "#include"
system_lib_string "<cstddef>"
preproc_include
#include "#include"
system_lib_string "<cstdint>"
preproc_include
#include "#include"
system_lib_string "<cstdlib>"
preproc_include
#include "#include"
system_lib_string "<cstring>"
preproc_include
#include "#include"
system_lib_string "<functional>"
preproc_include
#include "#include"
system_lib_string "<iterator>"
preproc_include
#include "#include"
system_lib_string "<list>"
preproc_include
#include "#include"
system_lib_string "<memory>"
preproc_include
#include "#include"
system_lib_string "<string>"
preproc_include
#include "#include"
system_lib_string "<type_traits>"
preproc_include
#include "#include"
system_lib_string "<utility>"
preproc_include
#include "#include"
system_lib_string "<vector>"
preproc_include
#include "#include"
system_lib_string "<gmock/gmock.h>"
preproc_include
#include "#include"
system_lib_string "<gtest/gtest.h>"
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/log/absl_check.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/numeric/bits.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/strings/str_cat.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/strings/string_view.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/types/optional.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "absl/types/span.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/arena_test_util.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/io/coded_stream.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/message.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/message_lite.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/unittest.pb.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/unittest_import.pb.h"
" "\""
comment "// Must be included last."
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/port_def.inc"
" "\""
namespace_definition
namespace "namespace"
namespace_identifier "google"
declaration_list
{ "{"
namespace_definition
namespace "namespace"
namespace_identifier "protobuf"
declaration_list
{ "{"
namespace_definition
namespace "namespace"
namespace_identifier "internal"
declaration_list
{ "{"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "proto2_unittest"
:: "::"
identifier "TestAllTypes"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "proto2_unittest"
:: "::"
identifier "TestMessageWithManyRepeatedPtrFields"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "A"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "AllOf"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "ElementsAre"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "Ge"
; ";"
using_declaration
using "using"
qualified_identifier
:: "::"
qualified_identifier
namespace_identifier "testing"
:: "::"
identifier "Le"
; ";"
alias_declaration
using "using"
type_identifier "String"
= "="
type_descriptor
qualified_identifier
namespace_identifier "std"
:: "::"
type_identifier "string"
; ";"
alias_declaration
using "using"
type_identifier "SmallMsg"
= "="
type_descriptor
qualified_identifier
namespace_identifier "proto2_unittest"
:: "::"
type_identifier "ForeignMessage"
; ";"
alias_declaration
using "using"
type_identifier "LargeMsg"
= "="
type_descriptor
qualified_identifier
namespace_identifier "proto2_unittest"
:: "::"
type_identifier "TestAllTypes"
; ";"
namespace_definition (+55 nodes collapsed)
comment "// namespace"
class_specifier (+59 nodes collapsed)
; ";"
function_definition (+272 nodes collapsed)
preproc_ifdef (+173 nodes collapsed)
function_definition (+282 nodes collapsed)
function_definition (+252 nodes collapsed)
function_definition (+267 nodes collapsed)
function_definition (+100 nodes collapsed)
function_definition (+51 nodes collapsed)
function_definition (+180 nodes collapsed)
comment "// This helper overload set tests whether X::f can be called"...
comment "// X::f({a, b}) of std::string iterators (specifically, poin"...
comment "// ambiguous if and only if the call to ValidResolutionPoint"...
template_declaration (+61 nodes collapsed)
template_declaration (+23 nodes collapsed)
function_definition (+247 nodes collapsed)
function_definition (+555 nodes collapsed)
function_definition (+198 nodes collapsed)
namespace_definition (+339 nodes collapsed)
comment "// namespace"
function_definition (+56 nodes collapsed)
function_definition (+330 nodes collapsed)
function_definition (+406 nodes collapsed)
function_definition (+356 nodes collapsed)
function_definition (+290 nodes collapsed)
function_definition (+390 nodes collapsed)
function_definition (+96 nodes collapsed)
function_definition (+55 nodes collapsed)
function_definition (+93 nodes collapsed)
function_definition (+108 nodes collapsed)
function_definition (+87 nodes collapsed)
comment "// TODO: Re-evaluate if this is still needed once the bug is"...
function_definition (+329 nodes collapsed)
comment "// Test all code paths in AddAllocated()."
function_definition (+587 nodes collapsed)
function_definition (+82 nodes collapsed)
function_definition (+65 nodes collapsed)
comment "// This test replicates a very specific scenario that used t"...
comment "// hard-to-debug failure in protoc during development."
function_definition (+316 nodes collapsed)
function_definition (+505 nodes collapsed)
function_definition (+534 nodes collapsed)
function_definition (+324 nodes collapsed)
function_definition (+329 nodes collapsed)
function_definition (+204 nodes collapsed)
function_definition (+97 nodes collapsed)
function_definition (+582 nodes collapsed)
function_definition (+249 nodes collapsed)
function_definition (+171 nodes collapsed)
function_definition (+266 nodes collapsed)
function_definition (+359 nodes collapsed)
function_definition (+488 nodes collapsed)
function_definition (+199 nodes collapsed)
function_definition (+149 nodes collapsed)
function_definition (+352 nodes collapsed)
function_definition (+1354 nodes collapsed)
function_definition
function_declarator
identifier "TEST_F"
parameter_list
( "("
parameter_declaration
type_identifier "RepeatedPtrFieldTest"
, ","
parameter_declaration
type_identifier "Resize"
) ")"
compound_statement
{ "{"
declaration
template_type
type_identifier "RepeatedPtrField"
template_argument_list
< "<"
type_descriptor
qualified_identifier
namespace_identifier "std"
:: "::"
type_identifier "string"
> ">"
identifier "rep"
; ";"
expression_statement
call_expression
identifier "EXPECT_THAT"
argument_list
( "("
identifier "rep"
, ","
call_expression
identifier "ElementsAre"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "rep"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "3"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_THAT"
argument_list
( "("
identifier "rep"
, ","
call_expression
identifier "ElementsAre"
argument_list
( "("
string_literal
" "\""
" "\""
, ","
string_literal
" "\""
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "rep"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "2"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_THAT"
argument_list
( "("
identifier "rep"
, ","
call_expression
identifier "ElementsAre"
argument_list
( "("
string_literal
" "\""
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "rep"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "4"
, ","
string_literal
" "\""
string_content "foo"
" "\""
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_THAT"
argument_list
( "("
identifier "rep"
, ","
call_expression
identifier "ElementsAre"
argument_list
( "("
string_literal
" "\""
" "\""
, ","
string_literal
" "\""
" "\""
, ","
string_literal
" "\""
string_content "foo"
" "\""
, ","
string_literal
" "\""
string_content "foo"
" "\""
) ")"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "rep"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "3"
, ","
string_literal
" "\""
string_content "bar"
" "\""
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_THAT"
argument_list
( "("
identifier "rep"
, ","
call_expression
identifier "ElementsAre"
argument_list
( "("
string_literal
" "\""
" "\""
, ","
string_literal
" "\""
" "\""
, ","
string_literal
" "\""
string_content "foo"
" "\""
) ")"
) ")"
; ";"
} "}"
function_definition
function_declarator
identifier "TEST_F"
parameter_list
( "("
parameter_declaration
type_identifier "RepeatedPtrFieldTest"
, ","
parameter_declaration
type_identifier "ResizeMessage"
) ")"
compound_statement
{ "{"
alias_declaration
using "using"
type_identifier "T"
= "="
type_descriptor
qualified_identifier
namespace_identifier "TestAllTypes"
:: "::"
type_identifier "NestedMessage"
; ";"
declaration
type_identifier "T"
identifier "msg"
; ";"
expression_statement
call_expression
field_expression
identifier "msg"
. "."
field_identifier "set_bb"
argument_list
( "("
number_literal "1"
) ")"
; ";"
declaration
template_type
type_identifier "RepeatedPtrField"
template_argument_list
< "<"
type_descriptor
type_identifier "T"
> ">"
identifier "rep"
; ";"
expression_statement
call_expression
field_expression
identifier "rep"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "2"
, ","
identifier "msg"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "rep"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "3"
) ")"
; ";"
expression_statement
call_expression
identifier "ASSERT_EQ"
argument_list
( "("
call_expression
field_expression
identifier "rep"
. "."
field_identifier "size"
argument_list
( "("
) ")"
, ","
number_literal "3"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_EQ"
argument_list
( "("
call_expression
field_expression
subscript_expression
identifier "rep"
subscript_argument_list
[ "["
number_literal "0"
] "]"
. "."
field_identifier "bb"
argument_list
( "("
) ")"
, ","
number_literal "1"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_EQ"
argument_list
( "("
call_expression
field_expression
subscript_expression
identifier "rep"
subscript_argument_list
[ "["
number_literal "1"
] "]"
. "."
field_identifier "bb"
argument_list
( "("
) ")"
, ","
number_literal "1"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_EQ"
argument_list
( "("
call_expression
field_expression
subscript_expression
identifier "rep"
subscript_argument_list
[ "["
number_literal "2"
] "]"
. "."
field_identifier "bb"
argument_list
( "("
) ")"
, ","
number_literal "0"
) ")"
; ";"
} "}"
function_definition
function_declarator
identifier "TEST_F"
parameter_list
( "("
parameter_declaration
type_identifier "RepeatedPtrFieldTest"
, ","
parameter_declaration
type_identifier "ResizeMessageWithBaseClass"
) ")"
compound_statement
{ "{"
alias_declaration
using "using"
type_identifier "T"
= "="
type_descriptor
qualified_identifier
namespace_identifier "TestAllTypes"
:: "::"
type_identifier "NestedMessage"
; ";"
declaration
type_identifier "T"
identifier "msg"
; ";"
expression_statement
call_expression
field_expression
identifier "msg"
. "."
field_identifier "set_bb"
argument_list
( "("
number_literal "1"
) ")"
; ";"
declaration
template_type
type_identifier "RepeatedPtrField"
template_argument_list
< "<"
type_descriptor
type_identifier "MessageLite"
> ">"
identifier "rep"
; ";"
expression_statement
call_expression
field_expression
identifier "rep"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "2"
, ","
identifier "msg"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "msg"
. "."
field_identifier "set_bb"
argument_list
( "("
number_literal "2"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "rep"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "3"
, ","
identifier "msg"
) ")"
; ";"
expression_statement
call_expression
identifier "ASSERT_EQ"
argument_list
( "("
call_expression
field_expression
identifier "rep"
. "."
field_identifier "size"
argument_list
( "("
) ")"
, ","
number_literal "3"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_EQ"
argument_list
( "("
call_expression
field_expression
call_expression
template_function
identifier "DownCastMessage"
template_argument_list
< "<"
type_descriptor
type_identifier "T"
> ">"
argument_list
( "("
subscript_expression
identifier "rep"
subscript_argument_list
[ "["
number_literal "0"
] "]"
) ")"
. "."
field_identifier "bb"
argument_list
( "("
) ")"
, ","
number_literal "1"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_EQ"
argument_list
( "("
call_expression
field_expression
call_expression
template_function
identifier "DownCastMessage"
template_argument_list
< "<"
type_descriptor
type_identifier "T"
> ">"
argument_list
( "("
subscript_expression
identifier "rep"
subscript_argument_list
[ "["
number_literal "1"
] "]"
) ")"
. "."
field_identifier "bb"
argument_list
( "("
) ")"
, ","
number_literal "1"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_EQ"
argument_list
( "("
call_expression
field_expression
call_expression
template_function
identifier "DownCastMessage"
template_argument_list
< "<"
type_descriptor
type_identifier "T"
> ">"
argument_list
( "("
subscript_expression
identifier "rep"
subscript_argument_list
[ "["
number_literal "2"
] "]"
) ")"
. "."
field_identifier "bb"
argument_list
( "("
) ")"
, ","
number_literal "2"
) ")"
; ";"
} "}"
function_definition
function_declarator
identifier "TEST_F"
parameter_list
( "("
parameter_declaration
type_identifier "RepeatedPtrFieldTest"
, ","
parameter_declaration
type_identifier "ResizeWithArenas"
) ")"
compound_statement
{ "{"
declaration
type_identifier "Arena"
identifier "arena"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "strs"
= "="
pointer_expression
* "*"
call_expression
qualified_identifier
namespace_identifier "Arena"
:: "::"
template_function
identifier "Create"
template_argument_list
< "<"
type_descriptor
template_type
type_identifier "RepeatedPtrField"
template_argument_list
< "<"
type_descriptor
qualified_identifier
namespace_identifier "std"
:: "::"
type_identifier "string"
> ">"
> ">"
argument_list
( "("
pointer_expression
& "&"
identifier "arena"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "strs"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "2"
, ","
string_literal
" "\""
string_content "Very long string to avoid SSO in the string."
" "\""
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "strs"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "1"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_THAT"
argument_list
( "("
identifier "strs"
, ","
call_expression
identifier "ElementsAre"
argument_list
( "("
string_literal
" "\""
string_content "Very long string to avoid SSO in the string."
" "\""
) ")"
) ")"
; ";"
declaration
type_identifier "TestAllTypes"
identifier "msg_no_arena"
; ";"
expression_statement
call_expression
field_expression
identifier "msg_no_arena"
. "."
field_identifier "mutable_optional_nested_message"
argument_list
( "("
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
reference_declarator
& "&"
identifier "msgs"
= "="
pointer_expression
* "*"
call_expression
qualified_identifier
namespace_identifier "Arena"
:: "::"
template_function
identifier "Create"
template_argument_list
< "<"
type_descriptor
template_type
type_identifier "RepeatedPtrField"
template_argument_list
< "<"
type_descriptor
type_identifier "TestAllTypes"
> ">"
> ">"
argument_list
( "("
pointer_expression
& "&"
identifier "arena"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "msgs"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "2"
, ","
identifier "msg_no_arena"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "msgs"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "1"
) ")"
; ";"
expression_statement
call_expression
field_expression
identifier "msgs"
. "."
field_identifier "resize"
argument_list
( "("
number_literal "2"
) ")"
; ";"
expression_statement
call_expression
identifier "ASSERT_EQ"
argument_list
( "("
call_expression
field_expression
identifier "msgs"
. "."
field_identifier "size"
argument_list
( "("
) ")"
, ","
number_literal "2"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_TRUE"
argument_list
( "("
call_expression
field_expression
subscript_expression
identifier "msgs"
subscript_argument_list
[ "["
number_literal "0"
] "]"
. "."
field_identifier "has_optional_nested_message"
argument_list
( "("
) ")"
) ")"
; ";"
expression_statement
call_expression
identifier "EXPECT_FALSE"
argument_list
( "("
call_expression
field_expression
subscript_expression
identifier "msgs"
subscript_argument_list
[ "["
number_literal "1"
] "]"
. "."
field_identifier "has_optional_nested_message"
argument_list
( "("
) ")"
) ")"
; ";"
} "}"
function_definition (+123 nodes collapsed)
function_definition (+155 nodes collapsed)
function_definition (+715 nodes collapsed)
function_definition
function_declarator
identifier "TEST_F"
parameter_list
( "("
parameter_declaration
type_identifier "RepeatedPtrFieldTest"
, ","
parameter_declaration
type_identifier "DeleteSubrange"
) ")"
compound_statement
{ "{"
comment "// DeleteSubrange is a trivial extension of ExtendSubrange."
} "}"
function_definition (+174 nodes collapsed)
function_definition (+169 nodes collapsed)
function_definition (+171 nodes collapsed)
comment "// ========================================================="...
class_specifier (+105 nodes collapsed)
; ";"
function_definition (+93 nodes collapsed)
function_definition (+145 nodes collapsed)
function_definition (+178 nodes collapsed)
function_definition (+145 nodes collapsed)
function_definition (+165 nodes collapsed)
function_definition (+163 nodes collapsed)
function_definition (+163 nodes collapsed)
function_definition (+68 nodes collapsed)
function_definition (+150 nodes collapsed)
function_definition (+197 nodes collapsed)
comment "// Uninitialized iterator does not point to any of the Repea"...
function_definition (+129 nodes collapsed)
function_definition (+265 nodes collapsed)
function_definition (+72 nodes collapsed)
comment "// ---------------------------------------------------------"...
class_specifier (+130 nodes collapsed)
; ";"
function_definition (+54 nodes collapsed)
function_definition (+54 nodes collapsed)
function_definition (+153 nodes collapsed)
function_definition (+153 nodes collapsed)
function_definition (+167 nodes collapsed)
function_definition (+167 nodes collapsed)
function_definition (+68 nodes collapsed)
function_definition (+150 nodes collapsed)
function_definition (+150 nodes collapsed)
function_definition (+197 nodes collapsed)
comment "// Uninitialized iterator does not point to any of the Repea"...
comment "// Dereferencing an uninitialized iterator crashes the proce"...
function_definition (+129 nodes collapsed)
function_definition (+129 nodes collapsed)
comment "// This comparison functor is required by the tests for Repe"...
comment "// They operate on strings and need to compare strings as st"...
comment "// any stl algorithm, even though the iterator returns a poi"...
comment "// string"
comment "// - i.e. *iter has type std::string*."
struct_specifier (+52 nodes collapsed)
; ";"
function_definition (+412 nodes collapsed)
function_definition (+222 nodes collapsed)
function_definition (+320 nodes collapsed)
comment "// ---------------------------------------------------------"...
comment "// Unit-tests for the insert iterators"
comment "// `google::protobuf::RepeatedPtrFieldBackInserter`,"
comment "// `google::protobuf::AllocatedRepeatedPtrFieldBackInserter`"
comment "// Ported from util/gtl/proto-array-iterators_unittest."
class_specifier (+426 nodes collapsed)
; ";"
function_definition (+93 nodes collapsed)
function_definition (+245 nodes collapsed)
function_definition (+131 nodes collapsed)
function_definition (+181 nodes collapsed)
function_definition (+210 nodes collapsed)
function_definition (+211 nodes collapsed)
function_definition (+224 nodes collapsed)
function_definition (+144 nodes collapsed)
function_definition (+244 nodes collapsed)
} "}"
comment "// namespace internal"
} "}"
comment "// namespace protobuf"
} "}"
comment "// namespace google"
preproc_include
#include "#include"
string_literal
" "\""
string_content "google/protobuf/port_undef.inc"
" "\""