PROTOBUF_SYNC_PIPER
pull/8895/head
Adam Cozzette 4 years ago
commit 4eed0dab5a
  1. 4
      BUILD
  2. 15
      Makefile.am
  3. 2
      Protobuf-C++.podspec
  4. 8
      autogen.sh
  5. 2
      benchmarks/java/pom.xml
  6. 52
      benchmarks/util/result_parser.py
  7. 20
      cmake/CMakeLists.txt
  8. 4
      cmake/extract_includes.bat.in
  9. 3
      cmake/libprotobuf-lite.cmake
  10. 2
      cmake/libprotobuf.cmake
  11. 2
      cmake/libprotoc.cmake
  12. 2
      cmake/protoc.cmake
  13. 2
      cmake/tests.cmake
  14. 4
      configure.ac
  15. 5
      java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java
  16. 4
      java/core/src/test/java/com/google/protobuf/TestUtil.java
  17. 14
      java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt
  18. 932
      java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt
  19. 2
      js/commonjs/export.js
  20. 2
      js/commonjs/export_asserts.js
  21. 2
      js/commonjs/export_testdeps.js
  22. 16
      js/compatibility_tests/v3.0.0/test.sh
  23. 77
      js/gulpfile.js
  24. 3
      js/package.json
  25. 2
      python/google/protobuf/__init__.py
  26. 26
      python/google/protobuf/internal/json_format_test.py
  27. 6
      python/google/protobuf/internal/well_known_types.py
  28. 8
      python/google/protobuf/pyext/message.cc
  29. 6
      src/Makefile.am
  30. 11
      src/google/protobuf/any.cc
  31. 17
      src/google/protobuf/any.h
  32. 2
      src/google/protobuf/any.pb.cc
  33. 19
      src/google/protobuf/any.pb.h
  34. 6
      src/google/protobuf/any_lite.cc
  35. 6
      src/google/protobuf/api.pb.cc
  36. 21
      src/google/protobuf/api.pb.h
  37. 4
      src/google/protobuf/arena.h
  38. 6
      src/google/protobuf/arena_impl.h
  39. 24
      src/google/protobuf/compiler/command_line_interface.cc
  40. 2
      src/google/protobuf/compiler/cpp/cpp_enum_field.cc
  41. 54
      src/google/protobuf/compiler/cpp/cpp_enum_field.h
  42. 2
      src/google/protobuf/compiler/cpp/cpp_file.cc
  43. 35
      src/google/protobuf/compiler/cpp/cpp_helpers.cc
  44. 12
      src/google/protobuf/compiler/cpp/cpp_helpers.h
  45. 27
      src/google/protobuf/compiler/cpp/cpp_message.cc
  46. 73
      src/google/protobuf/compiler/cpp/cpp_message_field.h
  47. 4
      src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
  48. 2
      src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
  49. 54
      src/google/protobuf/compiler/cpp/cpp_primitive_field.h
  50. 65
      src/google/protobuf/compiler/cpp/cpp_string_field.h
  51. 43
      src/google/protobuf/compiler/cpp/cpp_unittest.inc
  52. 12
      src/google/protobuf/compiler/importer.cc
  53. 2
      src/google/protobuf/compiler/java/java_enum_field.cc
  54. 18
      src/google/protobuf/compiler/java/java_enum_field.h
  55. 2
      src/google/protobuf/compiler/java/java_enum_field_lite.cc
  56. 6
      src/google/protobuf/compiler/java/java_extension.h
  57. 6
      src/google/protobuf/compiler/java/java_extension_lite.h
  58. 12
      src/google/protobuf/compiler/java/java_generator_factory.h
  59. 7
      src/google/protobuf/compiler/java/java_helpers.h
  60. 1
      src/google/protobuf/compiler/java/java_map_field.cc
  61. 2
      src/google/protobuf/compiler/java/java_map_field.h
  62. 1
      src/google/protobuf/compiler/java/java_map_field_lite.cc
  63. 8
      src/google/protobuf/compiler/java/java_message.cc
  64. 2
      src/google/protobuf/compiler/java/java_message_field.cc
  65. 53
      src/google/protobuf/compiler/java/java_message_field.h
  66. 2
      src/google/protobuf/compiler/java/java_message_field_lite.cc
  67. 22
      src/google/protobuf/compiler/java/java_message_field_lite.h
  68. 8
      src/google/protobuf/compiler/java/java_message_lite.cc
  69. 12
      src/google/protobuf/compiler/java/java_message_lite.h
  70. 2
      src/google/protobuf/compiler/java/java_primitive_field.cc
  71. 14
      src/google/protobuf/compiler/java/java_primitive_field.h
  72. 2
      src/google/protobuf/compiler/java/java_primitive_field_lite.cc
  73. 6
      src/google/protobuf/compiler/java/java_primitive_field_lite.h
  74. 2
      src/google/protobuf/compiler/java/java_service.h
  75. 53
      src/google/protobuf/compiler/java/java_string_field.h
  76. 2
      src/google/protobuf/compiler/java/java_string_field_lite.cc
  77. 4
      src/google/protobuf/compiler/js/js_generator.cc
  78. 22
      src/google/protobuf/compiler/parser.cc
  79. 4
      src/google/protobuf/compiler/parser_unittest.cc
  80. 15
      src/google/protobuf/compiler/plugin.cc
  81. 8
      src/google/protobuf/compiler/plugin.pb.cc
  82. 26
      src/google/protobuf/compiler/plugin.pb.h
  83. 10
      src/google/protobuf/descriptor.cc
  84. 60
      src/google/protobuf/descriptor.pb.cc
  85. 141
      src/google/protobuf/descriptor.pb.h
  86. 63
      src/google/protobuf/descriptor_unittest.cc
  87. 2
      src/google/protobuf/duration.pb.cc
  88. 11
      src/google/protobuf/duration.pb.h
  89. 4
      src/google/protobuf/dynamic_message.cc
  90. 2
      src/google/protobuf/dynamic_message_unittest.cc
  91. 11
      src/google/protobuf/empty.pb.h
  92. 20
      src/google/protobuf/extension_set.cc
  93. 6
      src/google/protobuf/extension_set.h
  94. 2
      src/google/protobuf/field_mask.pb.cc
  95. 11
      src/google/protobuf/field_mask.pb.h
  96. 6
      src/google/protobuf/generated_message_reflection.cc
  97. 5
      src/google/protobuf/generated_message_reflection_unittest.cc
  98. 9
      src/google/protobuf/generated_message_table_driven.h
  99. 7
      src/google/protobuf/inlined_string_field.h
  100. 9
      src/google/protobuf/io/coded_stream.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -189,8 +189,8 @@ cc_library(
"src/google/protobuf/dynamic_message.cc",
"src/google/protobuf/empty.pb.cc",
"src/google/protobuf/extension_set_heavy.cc",
"src/google/protobuf/field_access_listener.cc",
"src/google/protobuf/field_mask.pb.cc",
"src/google/protobuf/generated_message_bases.cc",
"src/google/protobuf/generated_message_reflection.cc",
"src/google/protobuf/generated_message_table_driven.cc",
"src/google/protobuf/io/gzip_stream.cc",
@ -667,6 +667,7 @@ cc_test(
"src/google/protobuf/arena_unittest.cc",
"src/google/protobuf/arenastring_unittest.cc",
"src/google/protobuf/compiler/annotation_test_util.cc",
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
@ -741,7 +742,6 @@ cc_test(
] + select({
"//conditions:default": [
# AUTOGEN(non_msvc_test_srcs)
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
],
":msvc": [],
}),

@ -280,6 +280,7 @@ java_EXTRA_DIST=
java/core/generate-sources-build.xml \
java/core/generate-test-sources-build.xml \
java/core/pom.xml \
java/core/pom_template.xml \
java/core/src/main/java/com/google/protobuf/AbstractMessage.java \
java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java \
java/core/src/main/java/com/google/protobuf/AbstractParser.java \
@ -535,6 +536,7 @@ java_EXTRA_DIST=
java/kotlin/generate-sources-build.xml \
java/kotlin/generate-test-sources-build.xml \
java/kotlin/pom.xml \
java/kotlin/src/main/kotlin/com/google/protobuf/ByteStrings.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt \
@ -544,6 +546,7 @@ java_EXTRA_DIST=
java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt\
java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/ByteStringsTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt\
@ -567,6 +570,7 @@ java_EXTRA_DIST=
java/lite/generate-test-sources-build.xml \
java/lite/lite.awk \
java/lite/pom.xml \
java/lite/pom_template.xml \
java/lite/process-lite-sources-build.xml \
java/lite/src/test/java/com/google/protobuf/LiteTest.java \
java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java \
@ -574,11 +578,11 @@ java_EXTRA_DIST=
java/pom.xml \
java/util/BUILD \
java/util/pom.xml \
java/util/pom_template.xml \
java/util/src/main/java/com/google/protobuf/util/Durations.java \
java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java \
java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java \
java/util/src/main/java/com/google/protobuf/util/JsonFormat.java \
java/util/src/main/java/com/google/protobuf/util/TimeUtil.java \
java/util/src/main/java/com/google/protobuf/util/Structs.java \
java/util/src/main/java/com/google/protobuf/util/Timestamps.java \
java/util/src/main/java/com/google/protobuf/util/Values.java \
@ -586,7 +590,6 @@ java_EXTRA_DIST=
java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java \
java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java \
java/util/src/test/java/com/google/protobuf/util/StructsTest.java \
java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java \
java/util/src/test/java/com/google/protobuf/util/ValuesTest.java \
java/util/src/test/proto/com/google/protobuf/util/json_test.proto
@ -801,6 +804,7 @@ objectivec_EXTRA_DIST= \
php_EXTRA_DIST= \
composer.json \
php/README.md \
php/REFCOUNTING.md \
php/composer.json \
php/ext/google/protobuf/arena.c \
php/ext/google/protobuf/arena.h \
@ -825,7 +829,6 @@ php_EXTRA_DIST= \
php/ext/google/protobuf/wkt.inc \
php/generate_descriptor_protos.sh \
php/generate_test_protos.sh \
php/prepare_c_extension.sh \
php/release.sh \
php/src/GPBMetadata/Google/Protobuf/Any.php \
php/src/GPBMetadata/Google/Protobuf/Api.php \
@ -1136,6 +1139,7 @@ ruby_EXTRA_DIST= \
ruby/ext/google/protobuf_c/ruby-upb.h \
ruby/ext/google/protobuf_c/wrap_memcpy.c \
ruby/google-protobuf.gemspec \
ruby/lib/google/protobuf/descriptor_dsl.rb \
ruby/lib/google/protobuf/message_exts.rb \
ruby/lib/google/protobuf/repeated_field.rb \
ruby/lib/google/protobuf/well_known_types.rb \
@ -1424,9 +1428,8 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
protobuf_deps.bzl \
third_party/six.BUILD \
third_party/zlib.BUILD \
third_party/wyhash/LICENSE \
third_party/wyhash/wyhash.h \
util/python/BUILD
util/python/BUILD \
internal.bzl
# Deletes all the files generated by autogen.sh.

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
s.version = '3.15.8'
s.version = '3.17.3'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = '3-Clause BSD License'

@ -30,8 +30,12 @@ set -ex
# The absence of a m4 directory in googletest causes autoreconf to fail when
# building under the CentOS docker image. It's a warning in regular build on
# Ubuntu/gLinux as well.
mkdir -p third_party/googletest/m4
# Ubuntu/gLinux as well. (This is only needed if git submodules have been
# initialized, which is typically only needed for testing; see the installation
# instructions for details.)
if test -d third_party/googletest; then
mkdir -p third_party/googletest/m4
fi
# TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings.
autoreconf -f -i -Wall,no-obsolete

@ -22,7 +22,7 @@
<dependency>
<groupId>com.google.caliper</groupId>
<artifactId>caliper</artifactId>
<version>1.0-beta-2</version>
<version>1.0-beta-3</version>
</dependency>
</dependencies>

@ -1,5 +1,6 @@
# This import depends on the automake rule protoc_middleman, please make sure
# protoc_middleman has been built before run this file.
import argparse
import json
import re
import os.path
@ -298,3 +299,54 @@ def get_result_from_file(cpp_file="",
__parse_php_result(php_c_file, "php")
return __results
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-cpp",
"--cpp_input_file",
help="The CPP benchmark result file's name",
default="")
parser.add_argument(
"-java",
"--java_input_file",
help="The Java benchmark result file's name",
default="")
parser.add_argument(
"-python",
"--python_input_file",
help="The Python benchmark result file's name",
default="")
parser.add_argument(
"-go",
"--go_input_file",
help="The golang benchmark result file's name",
default="")
parser.add_argument(
"-node",
"--node_input_file",
help="The node.js benchmark result file's name",
default="")
parser.add_argument(
"-php",
"--php_input_file",
help="The pure php benchmark result file's name",
default="")
parser.add_argument(
"-php_c",
"--php_c_input_file",
help="The php with c ext benchmark result file's name",
default="")
args = parser.parse_args()
results = get_result_from_file(
cpp_file=args.cpp_input_file,
java_file=args.java_input_file,
python_file=args.python_input_file,
go_file=args.go_input_file,
node_file=args.node_input_file,
php_file=args.php_input_file,
php_c_file=args.php_c_input_file,
)
print(json.dumps(results, indent=2))

@ -193,8 +193,10 @@ else (protobuf_BUILD_SHARED_LIBS)
endif (protobuf_BUILD_SHARED_LIBS)
if (MSVC)
# Build with multiple processes
add_definitions(/MP)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Build with multiple processes
add_definitions(/MP)
endif()
# MSVC warning suppressions
add_definitions(
/wd4018 # 'expression' : signed/unsigned mismatch
@ -222,12 +224,14 @@ if (MSVC)
# Suppress linker warnings about files with no symbols defined.
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
# Configure Resource Compiler
enable_language(RC)
# use English language (0x409) in resource compiler
set(rc_flags "/l0x409")
# fix rc.exe invocations because of usage of add_definitions()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Configure Resource Compiler
enable_language(RC)
# use English language (0x409) in resource compiler
set(rc_flags "/l0x409")
# fix rc.exe invocations because of usage of add_definitions()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
endif()
configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
endif (MSVC)

@ -46,11 +46,15 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" in
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_access_listener.h" include\google\protobuf\field_access_listener.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.h" include\google\protobuf\generated_message_tctable_impl.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.inc" include\google\protobuf\generated_message_tctable_impl.inc
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h

@ -7,6 +7,7 @@ set(libprotobuf_lite_files
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.cc
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc
${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
@ -57,7 +58,7 @@ set(libprotobuf_lite_includes
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
)
if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotobuf_lite_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)

@ -109,7 +109,7 @@ set(libprotobuf_includes
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h
)
if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotobuf_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)

@ -163,7 +163,7 @@ set(libprotoc_headers
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
)
if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(libprotoc_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)

@ -2,7 +2,7 @@ set(protoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/main.cc
)
if (MSVC)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(protoc_rc_files
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)

@ -155,6 +155,7 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/dynamic_message_unittest.cc
${protobuf_source_dir}/src/google/protobuf/extension_set_unittest.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection_unittest.cc
${protobuf_source_dir}/src/google/protobuf/inlined_string_field_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc
${protobuf_source_dir}/src/google/protobuf/io/printer_unittest.cc
@ -162,6 +163,7 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_unittest.cc
${protobuf_source_dir}/src/google/protobuf/map_field_test.cc
${protobuf_source_dir}/src/google/protobuf/map_test.cc
${protobuf_source_dir}/src/google/protobuf/map_test.inc
${protobuf_source_dir}/src/google/protobuf/message_unittest.cc
${protobuf_source_dir}/src/google/protobuf/message_unittest.inc
${protobuf_source_dir}/src/google/protobuf/no_field_presence_test.cc

@ -17,7 +17,7 @@ AC_PREREQ(2.59)
# In the SVN trunk, the version should always be the next anticipated release
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
# the size of one file name in the dist tarfile over the 99-char limit.)
AC_INIT([Protocol Buffers],[3.15.8],[protobuf@googlegroups.com],[protobuf])
AC_INIT([Protocol Buffers],[3.17.3],[protobuf@googlegroups.com],[protobuf])
AM_MAINTAINER_MODE([enable])
@ -125,7 +125,7 @@ AC_LINK_IFELSE(
[have_ld_version_script=yes; AC_MSG_RESULT(yes)],
[have_ld_version_script=no; AC_MSG_RESULT(no)])
LDFLAGS=$save_LDFLAGS
AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], [test "$have_ld_version_script" == "yes"])
AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], [test "$have_ld_version_script" = "yes"])
# Checks for header files.
AC_HEADER_STDC

@ -44,6 +44,7 @@ import java.net.URLClassLoader;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.Ignore;
/**
* Tests for {@link ExtensionRegistryFactory} and the {@link ExtensionRegistry} instances it
@ -55,8 +56,12 @@ import junit.framework.TestSuite;
*
* <p>The test mechanism employed here is based on the pattern in {@code
* com.google.common.util.concurrent.AbstractFutureFallbackAtomicHelperTest}
*
* <p>This test is temporarily disabled while we figure out how to fix the class loading used for
* testing lite functionality.
*/
@SuppressWarnings("JUnit4ClassUsedInJUnit3")
@Ignore
public class ExtensionRegistryFactoryTest extends TestCase {
// A classloader which blacklists some non-Lite classes.

@ -3758,7 +3758,9 @@ public final class TestUtil {
/** @param filePath The path relative to {@link #getTestDataDir}. */
public static String readTextFromFile(String filePath) {
return readBytesFromFile(filePath).toStringUtf8();
return readBytesFromFile(filePath)
.toStringUtf8()
.replace(System.getProperty("line.separator"), "\n");
}
private static File getTestDataDir() {

@ -34,14 +34,14 @@ import com.google.protobuf.ExtensionLite
import com.google.protobuf.MessageLite
/**
* Implementation for ExtensionList and ExtensionListLite. Like [DslList], represents an
* unmodifiable view of a repeated proto field -- in this case, an extension field -- but
* supports querying the extension.
* Implementation for ExtensionList and ExtensionListLite. Like [DslList], represents an
* unmodifiable view of a repeated proto field -- in this case, an extension field -- but supports
* querying the extension.
*/
class ExtensionList<E, M : MessageLite> @OnlyForUseByGeneratedProtoCode constructor(
val extension: ExtensionLite<M, List<E>>,
@JvmField private val delegate: List<E>
) : List<E> by delegate {
class ExtensionList<E, M : MessageLite>
@OnlyForUseByGeneratedProtoCode
constructor(val extension: ExtensionLite<M, List<E>>, private val delegate: List<E>) :
List<E> by delegate {
override fun iterator(): Iterator<E> = UnmodifiableIterator(delegate.iterator())
override fun listIterator(): ListIterator<E> = UnmodifiableListIterator(delegate.listIterator())

@ -5,8 +5,6 @@
* the google-protobuf.js file that we build at distribution time.
*/
// Include a dummy provide statement so that closurebuilder.py does not skip over this
// file.
goog.provide('jspb.Export');
goog.require('goog.object');

@ -6,8 +6,6 @@
* closure_asserts_commonjs.js that is only used at testing time.
*/
// Include a dummy provide statement so that closurebuilder.py does not skip over this
// file.
goog.provide('jspb.ExportAsserts');
goog.require('goog.testing.asserts');

@ -7,8 +7,6 @@
* export_asserts.js.
*/
// Include a dummy provide statement so that closurebuilder.py does not skip over this
// file.
goog.provide('jspb.ExportTestDeps');
goog.require('goog.crypt.base64');

@ -53,8 +53,20 @@ for file in *_test.js binary/*_test.js; do
done
cp commonjs/{jasmine.json,import_test.js} commonjs_out/
mkdir -p commonjs_out/test_node_modules
../../node_modules/google-closure-library/closure/bin/calcdeps.py -i commonjs/export_asserts.js -p . -p ../../node_modules/google-closure-library/closure -o compiled --compiler_jar ../../node_modules/google-closure-compiler/compiler.jar > commonjs_out/test_node_modules/closure_asserts_commonjs.js
../../node_modules/google-closure-library/closure/bin/calcdeps.py -i commonjs/export_testdeps.js -p ../.. -p ../../node_modules/google-closure-library/closure -o compiled --compiler_jar ../../node_modules/google-closure-compiler/compiler.jar > commonjs_out/test_node_modules/testdeps_commonjs.js
../../node_modules/.bin/google-closure-compiler \
--entry_point=commonjs/export_asserts.js \
--js=commonjs/export_asserts.js \
--js=../../node_modules/google-closure-library/closure/goog/**.js \
--js=../../node_modules/google-closure-library/third_party/closure/goog/**.js \
> commonjs_out/test_node_modules/closure_asserts_commonjs.js
../../node_modules/.bin/google-closure-compiler \
--entry_point=commonjs/export_testdeps.js \
--js=commonjs/export_testdeps.js \
--js=../../binary/*.js \
--js=!../../binary/*_test.js \
--js=../../node_modules/google-closure-library/closure/goog/**.js \
--js=../../node_modules/google-closure-library/third_party/closure/goog/**.js \
> commonjs_out/test_node_modules/testdeps_commonjs.js
cp ../../google-protobuf.js commonjs_out/test_node_modules
cp -r ../../commonjs_out/node_modules commonjs_out

@ -140,50 +140,55 @@ gulp.task('genproto_group3_commonjs_strict', function (cb) {
});
function getClosureBuilderCommand(exportsFile, outputFile) {
return './node_modules/google-closure-library/closure/bin/build/closurebuilder.py ' +
'--root node_modules ' +
'-o compiled ' +
'--compiler_jar node_modules/google-closure-compiler-java/compiler.jar ' +
'-i ' + exportsFile + ' ' +
'map.js message.js binary/arith.js binary/constants.js binary/decoder.js ' +
'binary/encoder.js binary/reader.js binary/utils.js binary/writer.js ' +
exportsFile + ' > ' + outputFile;
function getClosureCompilerCommand(exportsFile, outputFile) {
const closureLib = 'node_modules/google-closure-library';
return [
'node_modules/.bin/google-closure-compiler',
`--js=${closureLib}/closure/goog/**.js`,
`--js=${closureLib}/third_party/closure/goog/**.js`, '--js=map.js',
'--js=message.js', '--js=binary/arith.js', '--js=binary/constants.js',
'--js=binary/decoder.js', '--js=binary/encoder.js', '--js=binary/reader.js',
'--js=binary/utils.js', '--js=binary/writer.js', `--js=${exportsFile}`,
`--entry_point=${exportsFile}`, `> ${outputFile}`
].join(' ');
}
gulp.task('dist', gulp.series(['genproto_wellknowntypes'], function(cb) {
// TODO(haberman): minify this more aggressively.
// Will require proper externs/exports.
exec(getClosureBuilderCommand('commonjs/export.js', 'google-protobuf.js'),
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
exec(
getClosureCompilerCommand('commonjs/export.js', 'google-protobuf.js'),
function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
}));
gulp.task('commonjs_asserts', function (cb) {
exec('mkdir -p commonjs_out/test_node_modules && ' +
getClosureBuilderCommand(
'commonjs/export_asserts.js',
'commonjs_out/test_node_modules/closure_asserts_commonjs.js'),
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
gulp.task('commonjs_asserts', function(cb) {
exec(
'mkdir -p commonjs_out/test_node_modules && ' +
getClosureCompilerCommand(
'commonjs/export_asserts.js',
'commonjs_out/test_node_modules/closure_asserts_commonjs.js'),
function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('commonjs_testdeps', function (cb) {
exec('mkdir -p commonjs_out/test_node_modules && ' +
getClosureBuilderCommand(
'commonjs/export_testdeps.js',
'commonjs_out/test_node_modules/testdeps_commonjs.js'),
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
gulp.task('commonjs_testdeps', function(cb) {
exec(
'mkdir -p commonjs_out/test_node_modules && ' +
getClosureCompilerCommand(
'commonjs/export_testdeps.js',
'commonjs_out/test_node_modules/testdeps_commonjs.js'),
function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task(
@ -229,7 +234,7 @@ gulp.task(
],
function(cb) {
exec(
'./node_modules/google-closure-library/closure/bin/build/depswriter.py binary/arith.js binary/constants.js binary/decoder.js binary/encoder.js binary/reader.js binary/utils.js binary/writer.js debug.js map.js message.js node_loader.js test_bootstrap.js > deps.js',
'./node_modules/.bin/closure-make-deps --closure-path=. --file=node_modules/google-closure-library/closure/goog/deps.js binary/arith.js binary/constants.js binary/decoder.js binary/encoder.js binary/reader.js binary/utils.js binary/writer.js debug.js map.js message.js node_loader.js test_bootstrap.js > deps.js',
function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);

@ -1,6 +1,6 @@
{
"name": "google-protobuf",
"version": "3.15.8",
"version": "3.17.3",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [
@ -10,6 +10,7 @@
"devDependencies": {
"glob": "~7.1.4",
"google-closure-compiler": "~20190819.0.0",
"google-closure-deps": "^20210406.0.0",
"google-closure-library": "~20190819.0.0",
"gulp": "~4.0.2",
"jasmine": "~3.4.0"

@ -30,4 +30,4 @@
# Copyright 2007 Google Inc. All Rights Reserved.
__version__ = '3.15.8'
__version__ = '3.17.3'

@ -1119,6 +1119,30 @@ class JsonFormatTest(JsonFormatBase):
'Failed to parse value field: Struct must be in a dict which is 1234',
json_format.Parse, text, message)
def testTimestampInvalidStringValue(self):
message = json_format_proto3_pb2.TestTimestamp()
text = '{"value": {"foo": 123}}'
self.assertRaisesRegexp(
json_format.ParseError,
r"Timestamp JSON value not a string: {u?'foo': 123}", json_format.Parse,
text, message)
def testDurationInvalidStringValue(self):
message = json_format_proto3_pb2.TestDuration()
text = '{"value": {"foo": 123}}'
self.assertRaisesRegexp(
json_format.ParseError,
r"Duration JSON value not a string: {u?'foo': 123}", json_format.Parse,
text, message)
def testFieldMaskInvalidStringValue(self):
message = json_format_proto3_pb2.TestFieldMask()
text = '{"value": {"foo": 123}}'
self.assertRaisesRegexp(
json_format.ParseError,
r"FieldMask JSON value not a string: {u?'foo': 123}", json_format.Parse,
text, message)
def testInvalidAny(self):
message = any_pb2.Any()
text = '{"@type": "type.googleapis.com/google.protobuf.Int32Value"}'
@ -1217,7 +1241,7 @@ class JsonFormatTest(JsonFormatBase):
def testParseDictUnknownValueType(self):
class UnknownClass(object):
def __str__(self):
def __repr__(self):
return 'v'
message = json_format_proto3_pb2.TestValue()
self.assertRaisesRegexp(

@ -143,6 +143,8 @@ class Timestamp(object):
Raises:
ValueError: On parsing problems.
"""
if not isinstance(value, six.string_types):
raise ValueError('Timestamp JSON value not a string: {!r}'.format(value))
timezone_offset = value.find('Z')
if timezone_offset == -1:
timezone_offset = value.find('+')
@ -303,6 +305,8 @@ class Duration(object):
Raises:
ValueError: On parsing problems.
"""
if not isinstance(value, six.string_types):
raise ValueError('Duration JSON value not a string: {!r}'.format(value))
if len(value) < 1 or value[-1] != 's':
raise ValueError(
'Duration must end with letter "s": {0}.'.format(value))
@ -428,6 +432,8 @@ class FieldMask(object):
def FromJsonString(self, value):
"""Converts string to FieldMask according to proto3 JSON spec."""
if not isinstance(value, six.string_types):
raise ValueError('FieldMask JSON value not a string: {!r}'.format(value))
self.Clear()
if value:
for path in value.split(','):

@ -110,9 +110,10 @@ class MessageReflectionFriend {
const std::vector<const FieldDescriptor*>& fields) {
lhs->GetReflection()->UnsafeShallowSwapFields(lhs, rhs, fields);
}
static bool IsLazyField(const Reflection* reflection,
static bool IsLazyField(const Reflection* reflection, const Message& message,
const FieldDescriptor* field) {
return reflection->IsLazyField(field);
return reflection->IsLazyField(field) ||
reflection->IsLazyExtension(message, field);
}
};
@ -2305,7 +2306,8 @@ CMessage* InternalGetSubMessage(
cmsg->parent_field_descriptor = field_descriptor;
if (reflection->HasField(*self->message, field_descriptor)) {
// Force triggering MutableMessage to set the lazy message 'Dirty'
if (MessageReflectionFriend::IsLazyField(reflection, field_descriptor)) {
if (MessageReflectionFriend::IsLazyField(reflection, *self->message,
field_descriptor)) {
Message* sub_message = reflection->MutableMessage(
self->message, field_descriptor, factory->message_factory);
cmsg->read_only = false;

@ -18,7 +18,7 @@ else
PTHREAD_DEF =
endif
PROTOBUF_VERSION = 26:8:0
PROTOBUF_VERSION = 28:3:0
if GCC
# Turn on all warnings except for sign comparison (we ignore sign comparison
@ -105,6 +105,9 @@ nobase_include_HEADERS = \
google/protobuf/generated_message_bases.h \
google/protobuf/generated_message_reflection.h \
google/protobuf/generated_message_table_driven.h \
google/protobuf/generated_message_tctable_decl.h \
google/protobuf/generated_message_tctable_impl.h \
google/protobuf/generated_message_tctable_impl.inc \
google/protobuf/generated_message_util.h \
google/protobuf/has_bits.h \
google/protobuf/implicit_weak_message.h \
@ -772,6 +775,7 @@ protobuf_test_SOURCES = \
google/protobuf/io/zero_copy_stream_unittest.cc \
google/protobuf/map_field_test.cc \
google/protobuf/map_test.cc \
google/protobuf/map_test.inc \
google/protobuf/message_unittest.cc \
google/protobuf/message_unittest.inc \
google/protobuf/no_field_presence_test.cc \

@ -41,18 +41,17 @@ namespace google {
namespace protobuf {
namespace internal {
bool AnyMetadata::PackFrom(const Message& message) {
return PackFrom(message, kTypeGoogleApisComPrefix);
bool AnyMetadata::PackFrom(Arena* arena, const Message& message) {
return PackFrom(arena, message, kTypeGoogleApisComPrefix);
}
bool AnyMetadata::PackFrom(const Message& message,
bool AnyMetadata::PackFrom(Arena* arena, const Message& message,
StringPiece type_url_prefix) {
type_url_->Set(
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString(),
GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix),
nullptr);
GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena);
return message.SerializeToString(
value_->Mutable(ArenaStringPtr::EmptyDefault{}, nullptr));
value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena));
}
bool AnyMetadata::UnpackTo(Message* message) const {

@ -67,12 +67,12 @@ class PROTOBUF_EXPORT AnyMetadata {
// The resulted type URL will be "type.googleapis.com/<message_full_name>".
// Returns false if serializing the message failed.
template <typename T>
bool PackFrom(const T& message) {
return InternalPackFrom(message, kTypeGoogleApisComPrefix,
bool PackFrom(Arena* arena, const T& message) {
return InternalPackFrom(arena, message, kTypeGoogleApisComPrefix,
T::FullMessageName());
}
bool PackFrom(const Message& message);
bool PackFrom(Arena* arena, const Message& message);
// Packs a message using the given type URL prefix. The type URL will be
// constructed by concatenating the message type's full name to the prefix
@ -82,11 +82,14 @@ class PROTOBUF_EXPORT AnyMetadata {
// URL: "type.googleapis.com/<message_full_name>".
// Returns false if serializing the message failed.
template <typename T>
bool PackFrom(const T& message, StringPiece type_url_prefix) {
return InternalPackFrom(message, type_url_prefix, T::FullMessageName());
bool PackFrom(Arena* arena, const T& message,
StringPiece type_url_prefix) {
return InternalPackFrom(arena, message, type_url_prefix,
T::FullMessageName());
}
bool PackFrom(const Message& message, StringPiece type_url_prefix);
bool PackFrom(Arena* arena, const Message& message,
StringPiece type_url_prefix);
// Unpacks the payload into the given message. Returns false if the message's
// type doesn't match the type specified in the type URL (i.e., the full
@ -108,7 +111,7 @@ class PROTOBUF_EXPORT AnyMetadata {
}
private:
bool InternalPackFrom(const MessageLite& message,
bool InternalPackFrom(Arena* arena, const MessageLite& message,
StringPiece type_url_prefix,
StringPiece type_name);
bool InternalUnpackTo(StringPiece type_name,

@ -124,7 +124,7 @@ Any::Any(const Any& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
}
inline void Any::SharedCtor() {
void Any::SharedCtor() {
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3015000
#if PROTOBUF_VERSION < 3017000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -52,7 +52,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fany_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto;
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto;
PROTOBUF_NAMESPACE_OPEN
class Any;
struct AnyDefaultTypeInternal;
@ -118,11 +118,11 @@ class PROTOBUF_EXPORT Any final :
// implements Any -----------------------------------------------
bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message) {
return _any_metadata_.PackFrom(message);
return _any_metadata_.PackFrom(GetArena(), message);
}
bool PackFrom(const ::PROTOBUF_NAMESPACE_ID::Message& message,
::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) {
return _any_metadata_.PackFrom(message, type_url_prefix);
return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix);
}
bool UnpackTo(::PROTOBUF_NAMESPACE_ID::Message* message) const {
return _any_metadata_.UnpackTo(message);
@ -133,12 +133,12 @@ class PROTOBUF_EXPORT Any final :
const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field);
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool PackFrom(const T& message) {
return _any_metadata_.PackFrom<T>(message);
return _any_metadata_.PackFrom<T>(GetArena(), message);
}
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool PackFrom(const T& message,
::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url_prefix) {
return _any_metadata_.PackFrom<T>(message, type_url_prefix);}
return _any_metadata_.PackFrom<T>(GetArena(), message, type_url_prefix);}
template <typename T, class = typename std::enable_if<!std::is_convertible<T, const ::PROTOBUF_NAMESPACE_ID::Message&>::value>::type>
bool UnpackTo(T* message) const {
return _any_metadata_.UnpackTo<T>(message);
@ -153,7 +153,12 @@ class PROTOBUF_EXPORT Any final :
}
inline void Swap(Any* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);

@ -53,13 +53,13 @@ const char kAnyFullTypeName[] = "google.protobuf.Any";
const char kTypeGoogleApisComPrefix[] = "type.googleapis.com/";
const char kTypeGoogleProdComPrefix[] = "type.googleprod.com/";
bool AnyMetadata::InternalPackFrom(const MessageLite& message,
bool AnyMetadata::InternalPackFrom(Arena* arena, const MessageLite& message,
StringPiece type_url_prefix,
StringPiece type_name) {
type_url_->Set(&::google::protobuf::internal::GetEmptyString(),
GetTypeUrl(type_name, type_url_prefix), nullptr);
GetTypeUrl(type_name, type_url_prefix), arena);
return message.SerializeToString(
value_->Mutable(ArenaStringPtr::EmptyDefault{}, nullptr));
value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena));
}
bool AnyMetadata::InternalUnpackTo(StringPiece type_name,

@ -218,7 +218,7 @@ Api::Api(const Api& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.Api)
}
inline void Api::SharedCtor() {
void Api::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
@ -631,7 +631,7 @@ Method::Method(const Method& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.Method)
}
inline void Method::SharedCtor() {
void Method::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@ -1022,7 +1022,7 @@ Mixin::Mixin(const Mixin& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin)
}
inline void Mixin::SharedCtor() {
void Mixin::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3015000
#if PROTOBUF_VERSION < 3017000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -54,7 +54,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fapi_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto;
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto;
PROTOBUF_NAMESPACE_OPEN
class Api;
struct ApiDefaultTypeInternal;
@ -130,7 +130,12 @@ class PROTOBUF_EXPORT Api final :
}
inline void Swap(Api* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -385,7 +390,12 @@ class PROTOBUF_EXPORT Method final :
}
inline void Swap(Method* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -618,7 +628,12 @@ class PROTOBUF_EXPORT Mixin final :
}
inline void Swap(Mixin* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);

@ -443,7 +443,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
}
static Arena* GetArenaForAllocationForNonMessageNonArenaConstructible(
const T* p, std::false_type /*has_get_arena*/) {
const T* /* p */, std::false_type /*has_get_arena*/) {
return nullptr;
}
@ -750,7 +750,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
}
template <typename T>
PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArenaInternal(
const T* value, std::false_type) {
const T* /* value */, std::false_type) {
return nullptr;
}

@ -214,13 +214,15 @@ class PROTOBUF_EXPORT SerialArena {
// Blocks are variable length malloc-ed objects. The following structure
// describes the common header for all blocks.
struct Block {
Block(Block* next, size_t size) : next(next), size(size), start(nullptr) {}
char* Pointer(size_t n) {
GOOGLE_DCHECK(n <= size);
return reinterpret_cast<char*>(this) + n;
}
Block* next;
size_t size;
Block* const next;
const size_t size;
CleanupNode* start;
// data follows
};

@ -298,36 +298,36 @@ class CommandLineInterface::ErrorPrinter
// implements MultiFileErrorCollector ------------------------------
void AddError(const std::string& filename, int line, int column,
const std::string& message) {
const std::string& message) override {
found_errors_ = true;
AddErrorOrWarning(filename, line, column, message, "error", std::cerr);
}
void AddWarning(const std::string& filename, int line, int column,
const std::string& message) {
const std::string& message) override {
found_warnings_ = true;
AddErrorOrWarning(filename, line, column, message, "warning", std::clog);
}
// implements io::ErrorCollector -----------------------------------
void AddError(int line, int column, const std::string& message) {
void AddError(int line, int column, const std::string& message) override {
AddError("input", line, column, message);
}
void AddWarning(int line, int column, const std::string& message) {
void AddWarning(int line, int column, const std::string& message) override {
AddErrorOrWarning("input", line, column, message, "warning", std::clog);
}
// implements DescriptorPool::ErrorCollector-------------------------
void AddError(const std::string& filename, const std::string& element_name,
const Message* descriptor, ErrorLocation location,
const std::string& message) {
const std::string& message) override {
AddErrorOrWarning(filename, -1, -1, message, "error", std::cerr);
}
void AddWarning(const std::string& filename, const std::string& element_name,
const Message* descriptor, ErrorLocation location,
const std::string& message) {
const std::string& message) override {
AddErrorOrWarning(filename, -1, -1, message, "warning", std::clog);
}
@ -400,14 +400,14 @@ class CommandLineInterface::GeneratorContextImpl : public GeneratorContext {
void GetOutputFilenames(std::vector<std::string>* output_filenames);
// implements GeneratorContext --------------------------------------
io::ZeroCopyOutputStream* Open(const std::string& filename);
io::ZeroCopyOutputStream* OpenForAppend(const std::string& filename);
io::ZeroCopyOutputStream* OpenForInsert(const std::string& filename,
const std::string& insertion_point);
io::ZeroCopyOutputStream* Open(const std::string& filename) override;
io::ZeroCopyOutputStream* OpenForAppend(const std::string& filename) override;
io::ZeroCopyOutputStream* OpenForInsert(
const std::string& filename, const std::string& insertion_point) override;
io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo(
const std::string& filename, const std::string& insertion_point,
const google::protobuf::GeneratedCodeInfo& info);
void ListParsedFiles(std::vector<const FileDescriptor*>* output) {
const google::protobuf::GeneratedCodeInfo& info) override;
void ListParsedFiles(std::vector<const FileDescriptor*>* output) override {
*output = parsed_files_;
}

@ -496,7 +496,7 @@ void RepeatedEnumFieldGenerator::GenerateConstinitInitializer(
format("$name$_()");
if (descriptor_->is_packed() &&
HasGeneratedMethods(descriptor_->file(), options_)) {
format("\n, _$name$_cached_byte_size_()");
format("\n, _$name$_cached_byte_size_(0)");
}
}

@ -50,17 +50,18 @@ class EnumFieldGenerator : public FieldGenerator {
~EnumFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
void GeneratePrivateMembers(io::Printer* printer) const override;
void GenerateAccessorDeclarations(io::Printer* printer) const override;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
@ -73,10 +74,10 @@ class EnumOneofFieldGenerator : public EnumFieldGenerator {
~EnumOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumOneofFieldGenerator);
@ -89,19 +90,20 @@ class RepeatedEnumFieldGenerator : public FieldGenerator {
~RepeatedEnumFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const {}
void GeneratePrivateMembers(io::Printer* printer) const override;
void GenerateAccessorDeclarations(io::Printer* printer) const override;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override {}
void GenerateMergeFromCodedStream(io::Printer* printer) const;
void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);

@ -1312,7 +1312,7 @@ void FileGenerator::GenerateGlobalStateFunctionDeclarations(
std::max(size_t(1), message_generators_.size()));
if (HasDescriptorMethods(file_, options_)) {
format(
"extern $dllexport_decl $const ::$proto_ns$::internal::DescriptorTable "
"$dllexport_decl $extern const ::$proto_ns$::internal::DescriptorTable "
"$desc_table$;\n");
}
}

@ -169,30 +169,6 @@ static std::unordered_set<std::string>* MakeKeywordsMap() {
static std::unordered_set<std::string>& kKeywords = *MakeKeywordsMap();
// Encode [0..63] as 'A'-'Z', 'a'-'z', '0'-'9', '_'
char Base63Char(int value) {
GOOGLE_CHECK_GE(value, 0);
if (value < 26) return 'A' + value;
value -= 26;
if (value < 26) return 'a' + value;
value -= 26;
if (value < 10) return '0' + value;
GOOGLE_CHECK_EQ(value, 10);
return '_';
}
// Given a c identifier has 63 legal characters we can't implement base64
// encoding. So we return the k least significant "digits" in base 63.
template <typename I>
std::string Base63(I n, int k) {
std::string res;
while (k-- > 0) {
res += Base63Char(static_cast<int>(n % 63));
n /= 63;
}
return res;
}
std::string IntTypeName(const Options& options, const std::string& type) {
if (options.opensource_runtime) {
return "::PROTOBUF_NAMESPACE_ID::" + type;
@ -803,6 +779,8 @@ std::string SafeFunctionName(const Descriptor* descriptor,
bool IsStringInlined(const FieldDescriptor* descriptor,
const Options& options) {
(void)descriptor;
(void)options;
return false;
}
@ -965,11 +943,17 @@ bool HasEnumDefinitions(const FileDescriptor* file) {
bool ShouldVerify(const Descriptor* descriptor, const Options& options,
MessageSCCAnalyzer* scc_analyzer) {
(void)descriptor;
(void)options;
(void)scc_analyzer;
return false;
}
bool ShouldVerify(const FileDescriptor* file, const Options& options,
MessageSCCAnalyzer* scc_analyzer) {
(void)file;
(void)options;
(void)scc_analyzer;
return false;
}
@ -1165,7 +1149,7 @@ bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options,
MessageAnalysis MessageSCCAnalyzer::GetSCCAnalysis(const SCC* scc) {
if (analysis_cache_.count(scc)) return analysis_cache_[scc];
MessageAnalysis result{};
MessageAnalysis result;
if (UsingImplicitWeakFields(scc->GetFile(), options_)) {
result.contains_weak = true;
}
@ -1493,6 +1477,7 @@ FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file,
}
bool EnableMessageOwnedArena(const Descriptor* desc) {
(void)desc;
return false;
}

@ -363,7 +363,7 @@ inline bool IsEagerlyVerifiedLazy(const FieldDescriptor* field,
}
inline bool IsFieldUsed(const FieldDescriptor* /* field */,
const Options& options) {
const Options& /* options */) {
return true;
}
@ -565,11 +565,11 @@ inline static bool ShouldIgnoreRequiredFieldCheck(const FieldDescriptor* field,
}
struct MessageAnalysis {
bool is_recursive;
bool contains_cord;
bool contains_extension;
bool contains_required;
bool contains_weak; // Implicit weak as well.
bool is_recursive = false;
bool contains_cord = false;
bool contains_extension = false;
bool contains_required = false;
bool contains_weak = false; // Implicit weak as well.
};
// This class is used in FileGenerator, to ensure linear instead of

@ -1476,7 +1476,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
if (options_.table_driven_serialization) {
format(
"private:\n"
"const void* InternalGetTable() const;\n"
"const void* InternalGetTable() const override;\n"
"public:\n"
"\n");
}
@ -1560,12 +1560,13 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
if (HasDescriptorMethods(descriptor_->file(), options_)) {
format(
"bool PackFrom(const ::$proto_ns$::Message& message) {\n"
" return _any_metadata_.PackFrom(message);\n"
" return _any_metadata_.PackFrom(GetArena(), message);\n"
"}\n"
"bool PackFrom(const ::$proto_ns$::Message& message,\n"
" ::PROTOBUF_NAMESPACE_ID::ConstStringParam "
"type_url_prefix) {\n"
" return _any_metadata_.PackFrom(message, type_url_prefix);\n"
" return _any_metadata_.PackFrom(GetArena(), message, "
"type_url_prefix);\n"
"}\n"
"bool UnpackTo(::$proto_ns$::Message* message) const {\n"
" return _any_metadata_.UnpackTo(message);\n"
@ -1578,7 +1579,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
"!std::is_convertible<T, const ::$proto_ns$::Message&>"
"::value>::type>\n"
"bool PackFrom(const T& message) {\n"
" return _any_metadata_.PackFrom<T>(message);\n"
" return _any_metadata_.PackFrom<T>(GetArena(), message);\n"
"}\n"
"template <typename T, class = typename std::enable_if<"
"!std::is_convertible<T, const ::$proto_ns$::Message&>"
@ -1586,7 +1587,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
"bool PackFrom(const T& message,\n"
" ::PROTOBUF_NAMESPACE_ID::ConstStringParam "
"type_url_prefix) {\n"
" return _any_metadata_.PackFrom<T>(message, type_url_prefix);"
" return _any_metadata_.PackFrom<T>(GetArena(), message, "
"type_url_prefix);"
"}\n"
"template <typename T, class = typename std::enable_if<"
"!std::is_convertible<T, const ::$proto_ns$::Message&>"
@ -1598,13 +1600,14 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
format(
"template <typename T>\n"
"bool PackFrom(const T& message) {\n"
" return _any_metadata_.PackFrom(message);\n"
" return _any_metadata_.PackFrom(GetArena(), message);\n"
"}\n"
"template <typename T>\n"
"bool PackFrom(const T& message,\n"
" ::PROTOBUF_NAMESPACE_ID::ConstStringParam "
"type_url_prefix) {\n"
" return _any_metadata_.PackFrom(message, type_url_prefix);\n"
" return _any_metadata_.PackFrom(GetArena(), message, "
"type_url_prefix);\n"
"}\n"
"template <typename T>\n"
"bool UnpackTo(T* message) const {\n"
@ -1626,12 +1629,12 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
"}\n"
"inline void Swap($classname$* other) {\n"
" if (other == this) return;\n"
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
"#ifdef PROTOBUF_FORCE_COPY_IN_SWAP\n"
" if (GetOwningArena() != nullptr &&\n"
" GetOwningArena() == other->GetOwningArena()) {\n"
#else // PROTOBUF_FORCE_COPY_IN_SWAP
" GetOwningArena() == other->GetOwningArena()) {\n "
"#else // PROTOBUF_FORCE_COPY_IN_SWAP\n"
" if (GetOwningArena() == other->GetOwningArena()) {\n"
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
"#endif // !PROTOBUF_FORCE_COPY_IN_SWAP\n"
" InternalSwap(other);\n"
" } else {\n"
" ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);\n"
@ -2796,7 +2799,7 @@ void MessageGenerator::GenerateSharedConstructorCode(io::Printer* printer) {
if (HasSimpleBaseClass(descriptor_, options_)) return;
Formatter format(printer, variables_);
format("inline void $classname$::SharedCtor() {\n");
format("void $classname$::SharedCtor() {\n");
std::vector<bool> processed(optimized_order_.size(), false);
GenerateConstructorBody(printer, processed, false);

@ -53,22 +53,25 @@ class MessageFieldGenerator : public FieldGenerator {
~MessageFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateInternalAccessorDeclarations(io::Printer* printer) const;
void GenerateInternalAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMessageClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateDestructorCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
void GeneratePrivateMembers(io::Printer* printer) const override;
void GenerateAccessorDeclarations(io::Printer* printer) const override;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateNonInlineAccessorDefinitions(
io::Printer* printer) const override;
void GenerateInternalAccessorDeclarations(
io::Printer* printer) const override;
void GenerateInternalAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMessageClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateDestructorCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
protected:
const bool implicit_weak_field_;
@ -85,16 +88,17 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator {
~MessageOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateNonInlineAccessorDefinitions(
io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
// MessageFieldGenerator, from which we inherit, overrides this so we need to
// override it as well.
void GenerateMessageClearingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateDestructorCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateMessageClearingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateDestructorCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator);
@ -108,17 +112,18 @@ class RepeatedMessageFieldGenerator : public FieldGenerator {
~RepeatedMessageFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const {}
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
void GeneratePrivateMembers(io::Printer* printer) const override;
void GenerateAccessorDeclarations(io::Printer* printer) const override;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override {}
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
private:
const bool implicit_weak_field_;

@ -1145,6 +1145,10 @@ std::string FieldParseFunctionName(const FieldDescriptor* field,
case Utf8CheckMode::kVerify:
type_format = TypeFormat::kStringValidateOnly;
break;
default:
GOOGLE_LOG(DFATAL) << "Mode not handled: "
<< static_cast<int>(GetUtf8CheckMode(field, options));
return "";
}
break;

@ -495,7 +495,7 @@ void RepeatedPrimitiveFieldGenerator::GenerateConstinitInitializer(
format("$name$_()");
if (descriptor_->is_packed() && FixedSize(descriptor_->type()) == -1 &&
HasGeneratedMethods(descriptor_->file(), options_)) {
format("\n, _$name$_cached_byte_size_()");
format("\n, _$name$_cached_byte_size_(0)");
}
}

@ -51,17 +51,18 @@ class PrimitiveFieldGenerator : public FieldGenerator {
~PrimitiveFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
void GeneratePrivateMembers(io::Printer* printer) const override;
void GenerateAccessorDeclarations(io::Printer* printer) const override;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
@ -74,10 +75,10 @@ class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator {
~PrimitiveOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator);
@ -90,17 +91,18 @@ class RepeatedPrimitiveFieldGenerator : public FieldGenerator {
~RepeatedPrimitiveFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
void GeneratePrivateMembers(io::Printer* printer) const override;
void GenerateAccessorDeclarations(io::Printer* printer) const override;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator);

@ -51,21 +51,23 @@ class StringFieldGenerator : public FieldGenerator {
~StringFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateStaticMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMessageClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const;
void GenerateDestructorCode(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
void GeneratePrivateMembers(io::Printer* printer) const override;
void GenerateStaticMembers(io::Printer* printer) const override;
void GenerateAccessorDeclarations(io::Printer* printer) const override;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateNonInlineAccessorDefinitions(
io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMessageClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override;
void GenerateDestructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
bool IsInlined() const override { return inlined_; }
private:
@ -80,14 +82,14 @@ class StringOneofFieldGenerator : public StringFieldGenerator {
~StringOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
// StringFieldGenerator, from which we inherit, overrides this so we need to
// override it as well.
void GenerateMessageClearingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateMessageClearingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringOneofFieldGenerator);
@ -100,17 +102,18 @@ class RepeatedStringFieldGenerator : public FieldGenerator {
~RepeatedStringFieldGenerator();
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateSwappingCode(io::Printer* printer) const;
void GenerateConstructorCode(io::Printer* printer) const;
void GenerateCopyConstructorCode(io::Printer* printer) const;
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
void GeneratePrivateMembers(io::Printer* printer) const override;
void GenerateAccessorDeclarations(io::Printer* printer) const override;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
void GenerateClearingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateSwappingCode(io::Printer* printer) const override;
void GenerateConstructorCode(io::Printer* printer) const override;
void GenerateCopyConstructorCode(io::Printer* printer) const override;
void GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const override;
void GenerateByteSize(io::Printer* printer) const override;
void GenerateConstinitInitializer(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedStringFieldGenerator);

@ -101,7 +101,7 @@ class MockErrorCollector : public MultiFileErrorCollector {
// implements ErrorCollector ---------------------------------------
void AddError(const std::string& filename, int line, int column,
const std::string& message) {
const std::string& message) override {
strings::SubstituteAndAppend(&text_, "$0:$1:$2: $3\n", filename, line, column,
message);
}
@ -1159,10 +1159,8 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
// implements TestService ----------------------------------------
void Foo(RpcController* controller,
const UNITTEST::FooRequest* request,
UNITTEST::FooResponse* response,
Closure* done) {
void Foo(RpcController* controller, const UNITTEST::FooRequest* request,
UNITTEST::FooResponse* response, Closure* done) override {
ASSERT_FALSE(called_);
called_ = true;
method_ = "Foo";
@ -1172,10 +1170,8 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
done_ = done;
}
void Bar(RpcController* controller,
const UNITTEST::BarRequest* request,
UNITTEST::BarResponse* response,
Closure* done) {
void Bar(RpcController* controller, const UNITTEST::BarRequest* request,
UNITTEST::BarResponse* response, Closure* done) override {
ASSERT_FALSE(called_);
called_ = true;
method_ = "Bar";
@ -1214,11 +1210,9 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
// implements TestService ----------------------------------------
void CallMethod(const MethodDescriptor* method,
RpcController* controller,
const Message* request,
Message* response,
Closure* done) {
void CallMethod(const MethodDescriptor* method, RpcController* controller,
const Message* request, Message* response,
Closure* done) override {
ASSERT_FALSE(called_);
called_ = true;
method_ = method;
@ -1241,28 +1235,28 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
class MockController : public RpcController {
public:
void Reset() {
void Reset() override {
ADD_FAILURE() << "Reset() not expected during this test.";
}
bool Failed() const {
bool Failed() const override {
ADD_FAILURE() << "Failed() not expected during this test.";
return false;
}
std::string ErrorText() const {
std::string ErrorText() const override {
ADD_FAILURE() << "ErrorText() not expected during this test.";
return "";
}
void StartCancel() {
void StartCancel() override {
ADD_FAILURE() << "StartCancel() not expected during this test.";
}
void SetFailed(const std::string& reason) {
void SetFailed(const std::string& reason) override {
ADD_FAILURE() << "SetFailed() not expected during this test.";
}
bool IsCanceled() const {
bool IsCanceled() const override {
ADD_FAILURE() << "IsCanceled() not expected during this test.";
return false;
}
void NotifyOnCancel(Closure* callback) {
void NotifyOnCancel(Closure* callback) override {
ADD_FAILURE() << "NotifyOnCancel() not expected during this test.";
}
};
@ -1274,7 +1268,7 @@ class GENERATED_SERVICE_TEST_NAME : public testing::Test {
stub_(&mock_channel_),
done_(::google::protobuf::NewPermanentCallback(&DoNothing)) {}
virtual void SetUp() {
void SetUp() override {
ASSERT_TRUE(foo_ != NULL);
ASSERT_TRUE(bar_ != NULL);
}
@ -1415,7 +1409,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, NotImplemented) {
public:
ExpectUnimplementedController() : called_(false) {}
void SetFailed(const std::string& reason) {
void SetFailed(const std::string& reason) override {
EXPECT_FALSE(called_);
called_ = true;
EXPECT_EQ("Method Foo() not implemented.", reason);
@ -1437,8 +1431,7 @@ TEST_F(GENERATED_SERVICE_TEST_NAME, NotImplemented) {
class OneofTest : public testing::Test {
protected:
virtual void SetUp() {
}
void SetUp() override {}
void ExpectEnumCasesWork(const UNITTEST::TestOneof2 &message) {
switch (message.foo_case()) {

@ -290,11 +290,11 @@ static std::string CanonicalizePath(std::string path) {
std::vector<std::string> canonical_parts;
std::vector<std::string> parts = Split(
path, "/", true); // Note: Removes empty parts.
for (int i = 0; i < parts.size(); i++) {
if (parts[i] == ".") {
for (const std::string& part : parts) {
if (part == ".") {
// Ignore.
} else {
canonical_parts.push_back(parts[i]);
canonical_parts.push_back(part);
}
}
std::string result = Join(canonical_parts, "/");
@ -464,10 +464,10 @@ io::ZeroCopyInputStream* DiskSourceTree::OpenVirtualFile(
return NULL;
}
for (int i = 0; i < mappings_.size(); i++) {
for (const auto& mapping : mappings_) {
std::string temp_disk_file;
if (ApplyMapping(virtual_file, mappings_[i].virtual_path,
mappings_[i].disk_path, &temp_disk_file)) {
if (ApplyMapping(virtual_file, mapping.virtual_path, mapping.disk_path,
&temp_disk_file)) {
io::ZeroCopyInputStream* stream = OpenDiskFile(temp_disk_file);
if (stream != NULL) {
if (disk_file != NULL) {

@ -1110,6 +1110,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
@ -1133,6 +1134,7 @@ void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"

@ -101,15 +101,15 @@ class ImmutableEnumOneofFieldGenerator : public ImmutableEnumFieldGenerator {
Context* context);
~ImmutableEnumOneofFieldGenerator();
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateBuildingCode(io::Printer* printer) const;
void GenerateParsingCode(io::Printer* printer) const;
void GenerateSerializationCode(io::Printer* printer) const;
void GenerateSerializedSizeCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateBuildingCode(io::Printer* printer) const override;
void GenerateParsingCode(io::Printer* printer) const override;
void GenerateSerializationCode(io::Printer* printer) const override;
void GenerateSerializedSizeCode(io::Printer* printer) const override;
void GenerateEqualsCode(io::Printer* printer) const override;
void GenerateHashCode(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableEnumOneofFieldGenerator);

@ -852,6 +852,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
@ -875,6 +876,7 @@ void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"

@ -94,9 +94,9 @@ class ImmutableExtensionGenerator : public ExtensionGenerator {
Context* context);
virtual ~ImmutableExtensionGenerator();
virtual void Generate(io::Printer* printer);
virtual int GenerateNonNestedInitializationCode(io::Printer* printer);
virtual int GenerateRegistrationCode(io::Printer* printer);
void Generate(io::Printer* printer) override;
int GenerateNonNestedInitializationCode(io::Printer* printer) override;
int GenerateRegistrationCode(io::Printer* printer) override;
protected:
const FieldDescriptor* descriptor_;

@ -51,13 +51,13 @@ class ImmutableExtensionLiteGenerator : public ExtensionGenerator {
Context* context);
virtual ~ImmutableExtensionLiteGenerator();
virtual void Generate(io::Printer* printer);
void Generate(io::Printer* printer) override;
// Returns an estimate of the number of bytes the printed code will compile to
virtual int GenerateNonNestedInitializationCode(io::Printer* printer);
int GenerateNonNestedInitializationCode(io::Printer* printer) override;
// Returns an estimate of the number of bytes the printed code will compile to
virtual int GenerateRegistrationCode(io::Printer* printer);
int GenerateRegistrationCode(io::Printer* printer) override;
private:
const FieldDescriptor* descriptor_;

@ -80,14 +80,14 @@ class ImmutableGeneratorFactory : public GeneratorFactory {
ImmutableGeneratorFactory(Context* context);
virtual ~ImmutableGeneratorFactory();
virtual MessageGenerator* NewMessageGenerator(
const Descriptor* descriptor) const;
MessageGenerator* NewMessageGenerator(
const Descriptor* descriptor) const override;
virtual ExtensionGenerator* NewExtensionGenerator(
const FieldDescriptor* descriptor) const;
ExtensionGenerator* NewExtensionGenerator(
const FieldDescriptor* descriptor) const override;
virtual ServiceGenerator* NewServiceGenerator(
const ServiceDescriptor* descriptor) const;
ServiceGenerator* NewServiceGenerator(
const ServiceDescriptor* descriptor) const override;
private:
Context* context_;

@ -155,6 +155,7 @@ std::string GetOneofStoredType(const FieldDescriptor* field);
// Whether we should generate multiple java files for messages.
inline bool MultipleJavaFiles(const FileDescriptor* descriptor,
bool immutable) {
(void)immutable;
return descriptor->options().java_multiple_files();
}
@ -244,15 +245,15 @@ bool IsDefaultValueJavaDefault(const FieldDescriptor* field);
bool IsByteStringWithCustomDefaultValue(const FieldDescriptor* field);
// Does this message class have descriptor and reflection methods?
inline bool HasDescriptorMethods(const Descriptor* descriptor,
inline bool HasDescriptorMethods(const Descriptor* /* descriptor */,
bool enforce_lite) {
return !enforce_lite;
}
inline bool HasDescriptorMethods(const EnumDescriptor* descriptor,
inline bool HasDescriptorMethods(const EnumDescriptor* /* descriptor */,
bool enforce_lite) {
return !enforce_lite;
}
inline bool HasDescriptorMethods(const FileDescriptor* descriptor,
inline bool HasDescriptorMethods(const FileDescriptor* /* descriptor */,
bool enforce_lite) {
return !enforce_lite;
}

@ -709,6 +709,7 @@ void ImmutableMapFieldGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"set$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .set(key: $kt_key_type$, value: $kt_value_type$) {\n"

@ -65,7 +65,7 @@ class ImmutableMapFieldGenerator : public ImmutableFieldGenerator {
void GenerateHashCode(io::Printer* printer) const override;
void GenerateKotlinDslMembers(io::Printer* printer) const override;
std::string GetBoxedType() const;
std::string GetBoxedType() const override;
private:
const FieldDescriptor* descriptor_;

@ -852,6 +852,7 @@ void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"set$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" .set(key: $kt_key_type$, value: $kt_value_type$) {\n"

@ -1408,7 +1408,7 @@ void ImmutableMessageGenerator::GenerateKotlinDsl(io::Printer* printer) const {
"@com.google.protobuf.kotlin.ProtoDslMarker\n");
printer->Print(
"class Dsl private constructor(\n"
" @kotlin.jvm.JvmField private val _builder: $message$.Builder\n"
" private val _builder: $message$.Builder\n"
") {\n"
" companion object {\n"
" @kotlin.jvm.JvmSynthetic\n"
@ -1555,6 +1555,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun <T : Comparable<T>> set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n"
@ -1565,6 +1566,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, "
"com.google.protobuf.ByteString>,\n"
@ -1576,6 +1578,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n"
@ -1594,6 +1597,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign"
"(value: E) {\n"
@ -1613,6 +1617,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign(values: "
"Iterable<E>) {\n"
@ -1631,6 +1636,7 @@ void ImmutableMessageGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline fun com.google.protobuf.kotlin.ExtensionList<*, "
"$message$>.clear() {\n"
" clear(extension)\n"

@ -1432,6 +1432,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
@ -1455,6 +1456,7 @@ void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"

@ -65,25 +65,26 @@ class ImmutableMessageFieldGenerator : public ImmutableFieldGenerator {
// implements ImmutableFieldGenerator
// ---------------------------------------
int GetNumBitsForMessage() const;
int GetNumBitsForBuilder() const;
void GenerateInterfaceMembers(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateBuilderClearCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateBuildingCode(io::Printer* printer) const;
void GenerateParsingCode(io::Printer* printer) const;
void GenerateParsingDoneCode(io::Printer* printer) const;
void GenerateSerializationCode(io::Printer* printer) const;
void GenerateSerializedSizeCode(io::Printer* printer) const;
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
int GetNumBitsForMessage() const override;
int GetNumBitsForBuilder() const override;
void GenerateInterfaceMembers(io::Printer* printer) const override;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateInitializationCode(io::Printer* printer) const override;
void GenerateBuilderClearCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateBuildingCode(io::Printer* printer) const override;
void GenerateParsingCode(io::Printer* printer) const override;
void GenerateParsingDoneCode(io::Printer* printer) const override;
void GenerateSerializationCode(io::Printer* printer) const override;
void GenerateSerializedSizeCode(io::Printer* printer) const override;
void GenerateFieldBuilderInitializationCode(
io::Printer* printer) const override;
void GenerateEqualsCode(io::Printer* printer) const override;
void GenerateHashCode(io::Printer* printer) const override;
void GenerateKotlinDslMembers(io::Printer* printer) const override;
std::string GetBoxedType() const override;
protected:
const FieldDescriptor* descriptor_;
@ -111,13 +112,13 @@ class ImmutableMessageOneofFieldGenerator
Context* context);
~ImmutableMessageOneofFieldGenerator();
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateBuildingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateParsingCode(io::Printer* printer) const;
void GenerateSerializationCode(io::Printer* printer) const;
void GenerateSerializedSizeCode(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateBuildingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateParsingCode(io::Printer* printer) const override;
void GenerateSerializationCode(io::Printer* printer) const override;
void GenerateSerializedSizeCode(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldGenerator);

@ -822,6 +822,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
@ -845,6 +846,7 @@ void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"

@ -66,16 +66,16 @@ class ImmutableMessageFieldLiteGenerator : public ImmutableFieldLiteGenerator {
// implements ImmutableFieldLiteGenerator
// ------------------------------------
int GetNumBitsForMessage() const;
void GenerateInterfaceMembers(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateInitializationCode(io::Printer* printer) const;
int GetNumBitsForMessage() const override;
void GenerateInterfaceMembers(io::Printer* printer) const override;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateInitializationCode(io::Printer* printer) const override;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
void GenerateKotlinDslMembers(io::Printer* printer) const;
std::vector<uint16_t>* output) const override;
void GenerateKotlinDslMembers(io::Printer* printer) const override;
std::string GetBoxedType() const;
std::string GetBoxedType() const override;
protected:
const FieldDescriptor* descriptor_;
@ -95,10 +95,10 @@ class ImmutableMessageOneofFieldLiteGenerator
Context* context);
~ImmutableMessageOneofFieldLiteGenerator();
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
std::vector<uint16_t>* output) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageOneofFieldLiteGenerator);

@ -732,7 +732,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinDsl(
"@com.google.protobuf.kotlin.ProtoDslMarker\n");
printer->Print(
"class Dsl private constructor(\n"
" @kotlin.jvm.JvmField private val _builder: $message$.Builder\n"
" private val _builder: $message$.Builder\n"
") {\n"
" companion object {\n"
" @kotlin.jvm.JvmSynthetic\n"
@ -877,6 +877,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun <T : Comparable<T>> set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n"
@ -887,6 +888,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, "
"com.google.protobuf.ByteString>,\n"
@ -898,6 +900,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n"
@ -916,6 +919,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign"
"(value: E) {\n"
@ -935,6 +939,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign(values: "
"Iterable<E>) {\n"
@ -953,6 +958,7 @@ void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline fun com.google.protobuf.kotlin.ExtensionList<*, "
"$message$>.clear() {\n"
" clear(extension)\n"

@ -50,12 +50,12 @@ class ImmutableMessageLiteGenerator : public MessageGenerator {
ImmutableMessageLiteGenerator(const Descriptor* descriptor, Context* context);
virtual ~ImmutableMessageLiteGenerator();
virtual void Generate(io::Printer* printer);
virtual void GenerateInterface(io::Printer* printer);
virtual void GenerateExtensionRegistrationCode(io::Printer* printer);
virtual void GenerateStaticVariables(io::Printer* printer,
int* bytecode_estimate);
virtual int GenerateStaticVariableInitializers(io::Printer* printer);
void Generate(io::Printer* printer) override;
void GenerateInterface(io::Printer* printer) override;
void GenerateExtensionRegistrationCode(io::Printer* printer) override;
void GenerateStaticVariables(io::Printer* printer,
int* bytecode_estimate) override;
int GenerateStaticVariableInitializers(io::Printer* printer) override;
void GenerateKotlinDsl(io::Printer* printer) const override;
void GenerateKotlinMembers(io::Printer* printer) const override;
void GenerateTopLevelKotlinMembers(io::Printer* printer) const override;

@ -864,6 +864,7 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
@ -887,6 +888,7 @@ void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"

@ -103,13 +103,13 @@ class ImmutablePrimitiveOneofFieldGenerator
int builderBitIndex, Context* context);
~ImmutablePrimitiveOneofFieldGenerator();
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateBuildingCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateParsingCode(io::Printer* printer) const;
void GenerateSerializationCode(io::Printer* printer) const;
void GenerateSerializedSizeCode(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateBuildingCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateParsingCode(io::Printer* printer) const override;
void GenerateSerializationCode(io::Printer* printer) const override;
void GenerateSerializedSizeCode(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldGenerator);

@ -687,6 +687,7 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
@ -710,6 +711,7 @@ void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"

@ -95,11 +95,11 @@ class ImmutablePrimitiveOneofFieldLiteGenerator
Context* context);
~ImmutablePrimitiveOneofFieldLiteGenerator();
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
std::vector<uint16_t>* output) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutablePrimitiveOneofFieldLiteGenerator);

@ -80,7 +80,7 @@ class ImmutableServiceGenerator : public ServiceGenerator {
Context* context);
virtual ~ImmutableServiceGenerator();
virtual void Generate(io::Printer* printer);
void Generate(io::Printer* printer) override;
private:
// Generate the getDescriptorForType() method.

@ -65,25 +65,26 @@ class ImmutableStringFieldGenerator : public ImmutableFieldGenerator {
// implements ImmutableFieldGenerator
// ---------------------------------------
int GetNumBitsForMessage() const;
int GetNumBitsForBuilder() const;
void GenerateInterfaceMembers(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateBuilderClearCode(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateBuildingCode(io::Printer* printer) const;
void GenerateParsingCode(io::Printer* printer) const;
void GenerateParsingDoneCode(io::Printer* printer) const;
void GenerateSerializationCode(io::Printer* printer) const;
void GenerateSerializedSizeCode(io::Printer* printer) const;
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
int GetNumBitsForMessage() const override;
int GetNumBitsForBuilder() const override;
void GenerateInterfaceMembers(io::Printer* printer) const override;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateInitializationCode(io::Printer* printer) const override;
void GenerateBuilderClearCode(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateBuildingCode(io::Printer* printer) const override;
void GenerateParsingCode(io::Printer* printer) const override;
void GenerateParsingDoneCode(io::Printer* printer) const override;
void GenerateSerializationCode(io::Printer* printer) const override;
void GenerateSerializedSizeCode(io::Printer* printer) const override;
void GenerateFieldBuilderInitializationCode(
io::Printer* printer) const override;
void GenerateEqualsCode(io::Printer* printer) const override;
void GenerateHashCode(io::Printer* printer) const override;
void GenerateKotlinDslMembers(io::Printer* printer) const override;
std::string GetBoxedType() const override;
protected:
const FieldDescriptor* descriptor_;
@ -103,13 +104,13 @@ class ImmutableStringOneofFieldGenerator
~ImmutableStringOneofFieldGenerator();
private:
void GenerateMembers(io::Printer* printer) const;
void GenerateBuilderMembers(io::Printer* printer) const;
void GenerateMergingCode(io::Printer* printer) const;
void GenerateBuildingCode(io::Printer* printer) const;
void GenerateParsingCode(io::Printer* printer) const;
void GenerateSerializationCode(io::Printer* printer) const;
void GenerateSerializedSizeCode(io::Printer* printer) const;
void GenerateMembers(io::Printer* printer) const override;
void GenerateBuilderMembers(io::Printer* printer) const override;
void GenerateMergingCode(io::Printer* printer) const override;
void GenerateBuildingCode(io::Printer* printer) const override;
void GenerateParsingCode(io::Printer* printer) const override;
void GenerateSerializationCode(io::Printer* printer) const override;
void GenerateSerializedSizeCode(io::Printer* printer) const override;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableStringOneofFieldGenerator);
};

@ -781,6 +781,7 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers(
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: kotlin.String) {\n"
@ -807,6 +808,7 @@ void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers(
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
"inline operator fun com.google.protobuf.kotlin.DslList"
"<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(values: kotlin.collections.Iterable<kotlin.String>) {\n"

@ -94,10 +94,6 @@ bool IsReserved(const std::string& ident) {
return false;
}
bool StrEndsWith(StringPiece sp, StringPiece x) {
return sp.size() >= x.size() && sp.substr(sp.size() - x.size()) == x;
}
std::string GetSnakeFilename(const std::string& filename) {
std::string snake_name = filename;
ReplaceCharacters(&snake_name, "/", '_');

@ -97,19 +97,19 @@ std::string MapEntryName(const std::string& field_name) {
static const char kSuffix[] = "Entry";
result.reserve(field_name.size() + sizeof(kSuffix));
bool cap_next = true;
for (int i = 0; i < field_name.size(); ++i) {
if (field_name[i] == '_') {
for (const char field_name_char : field_name) {
if (field_name_char == '_') {
cap_next = true;
} else if (cap_next) {
// Note: Do not use ctype.h due to locales.
if ('a' <= field_name[i] && field_name[i] <= 'z') {
result.push_back(field_name[i] - 'a' + 'A');
if ('a' <= field_name_char && field_name_char <= 'z') {
result.push_back(field_name_char - 'a' + 'A');
} else {
result.push_back(field_name[i]);
result.push_back(field_name_char);
}
cap_next = false;
} else {
result.push_back(field_name[i]);
result.push_back(field_name_char);
}
}
result.append(kSuffix);
@ -131,8 +131,8 @@ bool IsUpperCamelCase(const std::string& name) {
return false;
}
// Must not contains underscore.
for (int i = 1; i < name.length(); i++) {
if (name[i] == '_') {
for (const char c : name) {
if (c == '_') {
return false;
}
}
@ -140,8 +140,7 @@ bool IsUpperCamelCase(const std::string& name) {
}
bool IsUpperUnderscore(const std::string& name) {
for (int i = 0; i < name.length(); i++) {
const char c = name[i];
for (const char c : name) {
if (!IsUppercase(c) && c != '_' && !IsNumber(c)) {
return false;
}
@ -150,8 +149,7 @@ bool IsUpperUnderscore(const std::string& name) {
}
bool IsLowerUnderscore(const std::string& name) {
for (int i = 0; i < name.length(); i++) {
const char c = name[i];
for (const char c : name) {
if (!IsLowercase(c) && c != '_' && !IsNumber(c)) {
return false;
}

@ -88,7 +88,7 @@ class MockValidationErrorCollector : public DescriptorPool::ErrorCollector {
// implements ErrorCollector ---------------------------------------
void AddError(const std::string& filename, const std::string& element_name,
const Message* descriptor, ErrorLocation location,
const std::string& message) {
const std::string& message) override {
int line, column;
if (location == DescriptorPool::ErrorCollector::IMPORT) {
source_locations_.FindImport(descriptor, element_name, &line, &column);
@ -2588,7 +2588,7 @@ class SourceInfoTest : public ParserTest {
return true;
}
virtual void TearDown() {
void TearDown() override {
EXPECT_TRUE(spans_.empty()) << "Forgot to call HasSpan() for:\n"
<< spans_.begin()->second->DebugString();
}

@ -72,23 +72,24 @@ class GeneratorResponseContext : public GeneratorContext {
// implements GeneratorContext --------------------------------------
virtual io::ZeroCopyOutputStream* Open(const std::string& filename) {
io::ZeroCopyOutputStream* Open(const std::string& filename) override {
CodeGeneratorResponse::File* file = response_->add_file();
file->set_name(filename);
return new io::StringOutputStream(file->mutable_content());
}
virtual io::ZeroCopyOutputStream* OpenForInsert(
const std::string& filename, const std::string& insertion_point) {
io::ZeroCopyOutputStream* OpenForInsert(
const std::string& filename,
const std::string& insertion_point) override {
CodeGeneratorResponse::File* file = response_->add_file();
file->set_name(filename);
file->set_insertion_point(insertion_point);
return new io::StringOutputStream(file->mutable_content());
}
virtual io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo(
io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo(
const std::string& filename, const std::string& insertion_point,
const google::protobuf::GeneratedCodeInfo& info) {
const google::protobuf::GeneratedCodeInfo& info) override {
CodeGeneratorResponse::File* file = response_->add_file();
file->set_name(filename);
file->set_insertion_point(insertion_point);
@ -96,11 +97,11 @@ class GeneratorResponseContext : public GeneratorContext {
return new io::StringOutputStream(file->mutable_content());
}
void ListParsedFiles(std::vector<const FileDescriptor*>* output) {
void ListParsedFiles(std::vector<const FileDescriptor*>* output) override {
*output = parsed_files_;
}
void GetCompilerVersion(Version* version) const {
void GetCompilerVersion(Version* version) const override {
*version = compiler_version_;
}

@ -258,7 +258,7 @@ Version::Version(const Version& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version)
}
inline void Version::SharedCtor() {
void Version::SharedCtor() {
suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&major_) - reinterpret_cast<char*>(this)),
@ -581,7 +581,7 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest)
}
inline void CodeGeneratorRequest::SharedCtor() {
void CodeGeneratorRequest::SharedCtor() {
parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
compiler_version_ = nullptr;
}
@ -937,7 +937,7 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File)
}
inline void CodeGeneratorResponse_File::SharedCtor() {
void CodeGeneratorResponse_File::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@ -1280,7 +1280,7 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse)
}
inline void CodeGeneratorResponse::SharedCtor() {
void CodeGeneratorResponse::SharedCtor() {
error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
supported_features_ = uint64_t{0u};
}

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3015000
#if PROTOBUF_VERSION < 3017000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -60,7 +60,7 @@ struct PROTOC_EXPORT TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOC_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
PROTOC_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
PROTOBUF_NAMESPACE_OPEN
namespace compiler {
class CodeGeneratorRequest;
@ -173,7 +173,12 @@ class PROTOC_EXPORT Version final :
}
inline void Swap(Version* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -378,7 +383,12 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
}
inline void Swap(CodeGeneratorRequest* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -604,7 +614,12 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
}
inline void Swap(CodeGeneratorResponse_File* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -824,7 +839,12 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
}
inline void Swap(CodeGeneratorResponse* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);

@ -994,11 +994,11 @@ class TableArena {
}
static constexpr std::array<uint8_t, 6> kSmallSizes = {
// Sizes for pointer arrays.
8, 16, 24, 32,
// Sizes for string arrays (for descriptor names).
// The most common array sizes are 2 and 3.
2 * sizeof(std::string), 3 * sizeof(std::string)};
{// Sizes for pointer arrays.
8, 16, 24, 32,
// Sizes for string arrays (for descriptor names).
// The most common array sizes are 2 and 3.
2 * sizeof(std::string), 3 * sizeof(std::string)}};
// Helper function to iterate all lists.
std::array<Block*, 2 + kSmallSizes.size()> GetLists() const {

@ -393,9 +393,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT UninterpretedOptionDefaultTypeI
constexpr SourceCodeInfo_Location::SourceCodeInfo_Location(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: path_()
, _path_cached_byte_size_()
, _path_cached_byte_size_(0)
, span_()
, _span_cached_byte_size_()
, _span_cached_byte_size_(0)
, leading_detached_comments_()
, leading_comments_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
, trailing_comments_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
@ -423,7 +423,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SourceCodeInfoDefaultTypeIntern
constexpr GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: path_()
, _path_cached_byte_size_()
, _path_cached_byte_size_(0)
, source_file_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
, begin_(0)
, end_(0){}
@ -1282,7 +1282,7 @@ FileDescriptorSet::FileDescriptorSet(const FileDescriptorSet& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorSet)
}
inline void FileDescriptorSet::SharedCtor() {
void FileDescriptorSet::SharedCtor() {
}
FileDescriptorSet::~FileDescriptorSet() {
@ -1532,7 +1532,7 @@ FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorProto)
}
inline void FileDescriptorProto::SharedCtor() {
void FileDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@ -2159,7 +2159,7 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorP
// @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange)
}
inline void DescriptorProto_ExtensionRange::SharedCtor() {
void DescriptorProto_ExtensionRange::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@ -2430,7 +2430,7 @@ DescriptorProto_ReservedRange::DescriptorProto_ReservedRange(const DescriptorPro
// @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ReservedRange)
}
inline void DescriptorProto_ReservedRange::SharedCtor() {
void DescriptorProto_ReservedRange::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&start_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@ -2695,7 +2695,7 @@ DescriptorProto::DescriptorProto(const DescriptorProto& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto)
}
inline void DescriptorProto::SharedCtor() {
void DescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
options_ = nullptr;
}
@ -3206,7 +3206,7 @@ ExtensionRangeOptions::ExtensionRangeOptions(const ExtensionRangeOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.ExtensionRangeOptions)
}
inline void ExtensionRangeOptions::SharedCtor() {
void ExtensionRangeOptions::SharedCtor() {
}
ExtensionRangeOptions::~ExtensionRangeOptions() {
@ -3481,7 +3481,7 @@ FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto)
}
inline void FieldDescriptorProto::SharedCtor() {
void FieldDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@ -4073,7 +4073,7 @@ OneofDescriptorProto::OneofDescriptorProto(const OneofDescriptorProto& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.OneofDescriptorProto)
}
inline void OneofDescriptorProto::SharedCtor() {
void OneofDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
options_ = nullptr;
}
@ -4330,7 +4330,7 @@ EnumDescriptorProto_EnumReservedRange::EnumDescriptorProto_EnumReservedRange(con
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange)
}
inline void EnumDescriptorProto_EnumReservedRange::SharedCtor() {
void EnumDescriptorProto_EnumReservedRange::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&start_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@ -4585,7 +4585,7 @@ EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto)
}
inline void EnumDescriptorProto::SharedCtor() {
void EnumDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
options_ = nullptr;
}
@ -4959,7 +4959,7 @@ EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProt
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueDescriptorProto)
}
inline void EnumValueDescriptorProto::SharedCtor() {
void EnumValueDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
@ -5263,7 +5263,7 @@ ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& fro
// @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceDescriptorProto)
}
inline void ServiceDescriptorProto::SharedCtor() {
void ServiceDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
options_ = nullptr;
}
@ -5589,7 +5589,7 @@ MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto)
}
inline void MethodDescriptorProto::SharedCtor() {
void MethodDescriptorProto::SharedCtor() {
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@ -6096,7 +6096,7 @@ FileOptions::FileOptions(const FileOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions)
}
inline void FileOptions::SharedCtor() {
void FileOptions::SharedCtor() {
java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@ -7029,7 +7029,7 @@ MessageOptions::MessageOptions(const MessageOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions)
}
inline void MessageOptions::SharedCtor() {
void MessageOptions::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&message_set_wire_format_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&map_entry_) -
@ -7375,7 +7375,7 @@ FieldOptions::FieldOptions(const FieldOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions)
}
inline void FieldOptions::SharedCtor() {
void FieldOptions::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&ctype_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&jstype_) -
@ -7759,7 +7759,7 @@ OneofOptions::OneofOptions(const OneofOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.OneofOptions)
}
inline void OneofOptions::SharedCtor() {
void OneofOptions::SharedCtor() {
}
OneofOptions::~OneofOptions() {
@ -7976,7 +7976,7 @@ EnumOptions::EnumOptions(const EnumOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions)
}
inline void EnumOptions::SharedCtor() {
void EnumOptions::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&allow_alias_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&deprecated_) -
@ -8259,7 +8259,7 @@ EnumValueOptions::EnumValueOptions(const EnumValueOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueOptions)
}
inline void EnumValueOptions::SharedCtor() {
void EnumValueOptions::SharedCtor() {
deprecated_ = false;
}
@ -8503,7 +8503,7 @@ ServiceOptions::ServiceOptions(const ServiceOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceOptions)
}
inline void ServiceOptions::SharedCtor() {
void ServiceOptions::SharedCtor() {
deprecated_ = false;
}
@ -8752,7 +8752,7 @@ MethodOptions::MethodOptions(const MethodOptions& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions)
}
inline void MethodOptions::SharedCtor() {
void MethodOptions::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&deprecated_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&idempotency_level_) -
@ -9051,7 +9051,7 @@ UninterpretedOption_NamePart::UninterpretedOption_NamePart(const UninterpretedOp
// @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart)
}
inline void UninterpretedOption_NamePart::SharedCtor() {
void UninterpretedOption_NamePart::SharedCtor() {
name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
is_extension_ = false;
}
@ -9342,7 +9342,7 @@ UninterpretedOption::UninterpretedOption(const UninterpretedOption& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption)
}
inline void UninterpretedOption::SharedCtor() {
void UninterpretedOption::SharedCtor() {
identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@ -9770,7 +9770,7 @@ SourceCodeInfo_Location::SourceCodeInfo_Location(const SourceCodeInfo_Location&
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location)
}
inline void SourceCodeInfo_Location::SharedCtor() {
void SourceCodeInfo_Location::SharedCtor() {
leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@ -10138,7 +10138,7 @@ SourceCodeInfo::SourceCodeInfo(const SourceCodeInfo& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo)
}
inline void SourceCodeInfo::SharedCtor() {
void SourceCodeInfo::SharedCtor() {
}
SourceCodeInfo::~SourceCodeInfo() {
@ -10342,7 +10342,7 @@ GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeIn
// @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation)
}
inline void GeneratedCodeInfo_Annotation::SharedCtor() {
void GeneratedCodeInfo_Annotation::SharedCtor() {
source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&begin_) - reinterpret_cast<char*>(this)),
@ -10652,7 +10652,7 @@ GeneratedCodeInfo::GeneratedCodeInfo(const GeneratedCodeInfo& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo)
}
inline void GeneratedCodeInfo::SharedCtor() {
void GeneratedCodeInfo::SharedCtor() {
}
GeneratedCodeInfo::~GeneratedCodeInfo() {

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3015000
#if PROTOBUF_VERSION < 3017000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -53,7 +53,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fdescriptor_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto;
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto;
PROTOBUF_NAMESPACE_OPEN
class DescriptorProto;
struct DescriptorProtoDefaultTypeInternal;
@ -391,7 +391,12 @@ class PROTOBUF_EXPORT FileDescriptorSet final :
}
inline void Swap(FileDescriptorSet* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -550,7 +555,12 @@ class PROTOBUF_EXPORT FileDescriptorProto final :
}
inline void Swap(FileDescriptorProto* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -944,7 +954,12 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final :
}
inline void Swap(DescriptorProto_ExtensionRange* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -1134,7 +1149,12 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final :
}
inline void Swap(DescriptorProto_ReservedRange* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -1304,7 +1324,12 @@ class PROTOBUF_EXPORT DescriptorProto final :
}
inline void Swap(DescriptorProto* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -1653,7 +1678,12 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final :
}
inline void Swap(ExtensionRangeOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -2004,7 +2034,12 @@ class PROTOBUF_EXPORT FieldDescriptorProto final :
}
inline void Swap(FieldDescriptorProto* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -2433,7 +2468,12 @@ class PROTOBUF_EXPORT OneofDescriptorProto final :
}
inline void Swap(OneofDescriptorProto* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -2613,7 +2653,12 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final :
}
inline void Swap(EnumDescriptorProto_EnumReservedRange* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -2783,7 +2828,12 @@ class PROTOBUF_EXPORT EnumDescriptorProto final :
}
inline void Swap(EnumDescriptorProto* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -3031,7 +3081,12 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final :
}
inline void Swap(EnumValueDescriptorProto* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -3226,7 +3281,12 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final :
}
inline void Swap(ServiceDescriptorProto* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -3426,7 +3486,12 @@ class PROTOBUF_EXPORT MethodDescriptorProto final :
}
inline void Swap(MethodDescriptorProto* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -3676,7 +3741,12 @@ class PROTOBUF_EXPORT FileOptions final :
}
inline void Swap(FileOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -4410,7 +4480,12 @@ class PROTOBUF_EXPORT MessageOptions final :
}
inline void Swap(MessageOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -4822,7 +4897,12 @@ class PROTOBUF_EXPORT FieldOptions final :
}
inline void Swap(FieldOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -5328,7 +5408,12 @@ class PROTOBUF_EXPORT OneofOptions final :
}
inline void Swap(OneofOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -5679,7 +5764,12 @@ class PROTOBUF_EXPORT EnumOptions final :
}
inline void Swap(EnumOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -6061,7 +6151,12 @@ class PROTOBUF_EXPORT EnumValueOptions final :
}
inline void Swap(EnumValueOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -6428,7 +6523,12 @@ class PROTOBUF_EXPORT ServiceOptions final :
}
inline void Swap(ServiceOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -6795,7 +6895,12 @@ class PROTOBUF_EXPORT MethodOptions final :
}
inline void Swap(MethodOptions* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -7209,7 +7314,12 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final :
}
inline void Swap(UninterpretedOption_NamePart* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -7387,7 +7497,12 @@ class PROTOBUF_EXPORT UninterpretedOption final :
}
inline void Swap(UninterpretedOption* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -7654,7 +7769,12 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final :
}
inline void Swap(SourceCodeInfo_Location* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -7910,7 +8030,12 @@ class PROTOBUF_EXPORT SourceCodeInfo final :
}
inline void Swap(SourceCodeInfo* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -8071,7 +8196,12 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final :
}
inline void Swap(GeneratedCodeInfo_Annotation* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@ -8286,7 +8416,12 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final :
}
inline void Swap(GeneratedCodeInfo* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);

@ -206,7 +206,7 @@ class MockErrorCollector : public DescriptorPool::ErrorCollector {
// implements ErrorCollector ---------------------------------------
void AddError(const std::string& filename, const std::string& element_name,
const Message* descriptor, ErrorLocation location,
const std::string& message) {
const std::string& message) override {
const char* location_name = nullptr;
switch (location) {
case NAME:
@ -251,7 +251,7 @@ class MockErrorCollector : public DescriptorPool::ErrorCollector {
// implements ErrorCollector ---------------------------------------
void AddWarning(const std::string& filename, const std::string& element_name,
const Message* descriptor, ErrorLocation location,
const std::string& message) {
const std::string& message) override {
const char* location_name = nullptr;
switch (location) {
case NAME:
@ -299,7 +299,7 @@ class MockErrorCollector : public DescriptorPool::ErrorCollector {
// Test simple files.
class FileDescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following definitions:
//
// // in "foo.proto"
@ -565,7 +565,7 @@ void ExtractDebugString(
class SimpleErrorCollector : public io::ErrorCollector {
public:
// implements ErrorCollector ---------------------------------------
void AddError(int line, int column, const std::string& message) {
void AddError(int line, int column, const std::string& message) override {
last_error_ = StringPrintf("%d:%d:", line, column) + message;
}
@ -614,7 +614,7 @@ TEST_F(FileDescriptorTest, DebugStringRoundTrip) {
// Test simple flat messages and fields.
class DescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following definitions:
//
// // in "foo.proto"
@ -1101,7 +1101,7 @@ TEST_F(DescriptorTest, FieldEnumType) {
// Test simple flat messages and fields.
class OneofDescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following definitions:
//
// package garply;
@ -1192,7 +1192,7 @@ TEST_F(OneofDescriptorTest, FindByName) {
class StylizedFieldNamesTest : public testing::Test {
protected:
void SetUp() {
void SetUp() override {
FileDescriptorProto file;
file.set_name("foo.proto");
@ -1361,7 +1361,7 @@ TEST_F(StylizedFieldNamesTest, FindByCamelcaseName) {
// Test enum descriptors.
class EnumDescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following definitions:
//
// // in "foo.proto"
@ -1512,7 +1512,7 @@ TEST_F(EnumDescriptorTest, ValueType) {
// Test service descriptors.
class ServiceDescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following messages and service:
// // in "foo.proto"
// message FooRequest {}
@ -1673,7 +1673,7 @@ TEST_F(ServiceDescriptorTest, MethodOutputType) {
// Test nested types.
class NestedDescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following definitions:
//
// // in "foo.proto"
@ -1887,7 +1887,7 @@ TEST_F(NestedDescriptorTest, FindEnumValueByName) {
// Test extensions.
class ExtensionDescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following definitions:
//
// enum Baz {}
@ -2210,7 +2210,7 @@ TEST(OverlappingExtensionRangeTest, ExtensionRangeBefore) {
// Test reserved fields.
class ReservedDescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following definitions:
//
// message Foo {
@ -2288,7 +2288,7 @@ TEST_F(ReservedDescriptorTest, IsReservedName) {
// Test reserved enum fields.
class ReservedEnumDescriptorTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
// Build descriptors for the following definitions:
//
// enum Foo {
@ -2814,7 +2814,7 @@ class AllowUnknownDependenciesTest
DescriptorPoolMode mode() { return std::get<0>(GetParam()); }
const char* syntax() { return std::get<1>(GetParam()); }
virtual void SetUp() {
void SetUp() override {
FileDescriptorProto foo_proto, bar_proto;
switch (mode()) {
@ -6792,7 +6792,7 @@ class DatabaseBackedPoolTest : public testing::Test {
SimpleDescriptorDatabase database_;
virtual void SetUp() {
void SetUp() override {
AddToDatabase(
&database_,
"name: 'foo.proto' "
@ -6824,7 +6824,7 @@ class DatabaseBackedPoolTest : public testing::Test {
// implements DescriptorDatabase ---------------------------------
bool FindFileByName(const std::string& filename,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
// error.proto and error2.proto cyclically import each other.
if (filename == "error.proto") {
output->Clear();
@ -6841,12 +6841,12 @@ class DatabaseBackedPoolTest : public testing::Test {
}
}
bool FindFileContainingSymbol(const std::string& symbol_name,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
return false;
}
bool FindFileContainingExtension(const std::string& containing_type,
int field_number,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
return false;
}
};
@ -6869,18 +6869,18 @@ class DatabaseBackedPoolTest : public testing::Test {
// implements DescriptorDatabase ---------------------------------
bool FindFileByName(const std::string& filename,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
++call_count_;
return wrapped_db_->FindFileByName(filename, output);
}
bool FindFileContainingSymbol(const std::string& symbol_name,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
++call_count_;
return wrapped_db_->FindFileContainingSymbol(symbol_name, output);
}
bool FindFileContainingExtension(const std::string& containing_type,
int field_number,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
++call_count_;
return wrapped_db_->FindFileContainingExtension(containing_type,
field_number, output);
@ -6900,16 +6900,16 @@ class DatabaseBackedPoolTest : public testing::Test {
// implements DescriptorDatabase ---------------------------------
bool FindFileByName(const std::string& filename,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
return wrapped_db_->FindFileByName(filename, output);
}
bool FindFileContainingSymbol(const std::string& symbol_name,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
return FindFileByName("foo.proto", output);
}
bool FindFileContainingExtension(const std::string& containing_type,
int field_number,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
return FindFileByName("foo.proto", output);
}
};
@ -7185,7 +7185,7 @@ class ExponentialErrorDatabase : public DescriptorDatabase {
// implements DescriptorDatabase ---------------------------------
bool FindFileByName(const std::string& filename,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
int file_num = -1;
FullMatch(filename, "file", ".proto", &file_num);
if (file_num > -1) {
@ -7195,7 +7195,7 @@ class ExponentialErrorDatabase : public DescriptorDatabase {
}
}
bool FindFileContainingSymbol(const std::string& symbol_name,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
int file_num = -1;
FullMatch(symbol_name, "Message", "", &file_num);
if (file_num > 0) {
@ -7206,7 +7206,7 @@ class ExponentialErrorDatabase : public DescriptorDatabase {
}
bool FindFileContainingExtension(const std::string& containing_type,
int field_number,
FileDescriptorProto* output) {
FileDescriptorProto* output) override {
return false;
}
@ -7289,10 +7289,9 @@ class AbortingErrorCollector : public DescriptorPool::ErrorCollector {
public:
AbortingErrorCollector() {}
virtual void AddError(const std::string& filename,
const std::string& element_name, const Message* message,
ErrorLocation location,
const std::string& error_message) {
void AddError(const std::string& filename, const std::string& element_name,
const Message* message, ErrorLocation location,
const std::string& error_message) override {
GOOGLE_LOG(FATAL) << "AddError() called unexpectedly: " << filename << " ["
<< element_name << "]: " << error_message;
}
@ -7307,7 +7306,7 @@ class SingletonSourceTree : public compiler::SourceTree {
SingletonSourceTree(const std::string& filename, const std::string& contents)
: filename_(filename), contents_(contents) {}
virtual io::ZeroCopyInputStream* Open(const std::string& filename) {
io::ZeroCopyInputStream* Open(const std::string& filename) override {
return filename == filename_
? new io::ArrayInputStream(contents_.data(), contents_.size())
: nullptr;

@ -100,7 +100,7 @@ Duration::Duration(const Duration& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.Duration)
}
inline void Duration::SharedCtor() {
void Duration::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
reinterpret_cast<char*>(&seconds_) - reinterpret_cast<char*>(this)),
0, static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3015000
#if PROTOBUF_VERSION < 3017000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -52,7 +52,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fduration_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto;
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto;
PROTOBUF_NAMESPACE_OPEN
class Duration;
struct DurationDefaultTypeInternal;
@ -120,7 +120,12 @@ class PROTOBUF_EXPORT Duration final :
}
inline void Swap(Duration* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);

@ -843,7 +843,9 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock(
type_info->extensions_offset,
type_info->oneof_case_offset,
type_info->size,
type_info->weak_field_map_offset};
type_info->weak_field_map_offset,
nullptr /* inlined_string_indices_ */,
0 /* inlined_string_donated_offset_ */};
type_info->reflection.reset(
new Reflection(type_info->type, schema, type_info->pool, this));

@ -74,7 +74,7 @@ class DynamicMessageTest : public ::testing::TestWithParam<bool> {
DynamicMessageTest() : factory_(&pool_) {}
virtual void SetUp() {
void SetUp() override {
// We want to make sure that DynamicMessage works (particularly with
// extensions) even if we use descriptors that are *not* from compiled-in
// types, so we make copies of the descriptors for unittest.proto and

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3015000
#if PROTOBUF_VERSION < 3017000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -53,7 +53,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2fempty_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fempty_2eproto;
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fempty_2eproto;
PROTOBUF_NAMESPACE_OPEN
class Empty;
struct EmptyDefaultTypeInternal;
@ -120,7 +120,12 @@ class PROTOBUF_EXPORT Empty final :
}
inline void Swap(Empty* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);

@ -242,11 +242,15 @@ void ExtensionSet::DeleteFlatMap(const ExtensionSet::KeyValue* flat,
bool ExtensionSet::Has(int number) const {
const Extension* ext = FindOrNull(number);
if (ext == NULL) return false;
if (ext == nullptr) return false;
GOOGLE_DCHECK(!ext->is_repeated);
return !ext->is_cleared;
}
bool ExtensionSet::HasLazy(int number) const {
return Has(number) && FindOrNull(number)->is_lazy;
}
int ExtensionSet::NumExtensions() const {
int result = 0;
ForEach([&result](int /* number */, const Extension& ext) {
@ -1078,14 +1082,6 @@ void ExtensionSet::InternalExtensionMergeFrom(
other_extension.lazymessage_value->New(arena_);
extension->lazymessage_value->MergeFrom(
*other_extension.lazymessage_value, arena_);
} else if (&MaybeCreateLazyExtension != nullptr &&
(extension->lazymessage_value =
MaybeCreateLazyExtension(arena_)) != nullptr) {
// Binary has opted into lazy-after-merge; the destination of the
// merge is now a LazyField.
extension->lazymessage_value->MergeFromMessage(
*other_extension.message_value, arena_);
extension->is_lazy = true;
} else {
extension->is_lazy = false;
extension->message_value =
@ -2235,12 +2231,6 @@ size_t ExtensionSet::MessageSetByteSize() const {
return total_size;
}
#if !PROTOBUF_HAVE_ATTRIBUTE_WEAK
// If weak attributes are not supported define the default behavior.
ExtensionSet::LazyMessageExtension* MaybeCreateLazyExtension(Arena* arena) {
return nullptr;
}
#endif // PROTOBUF_HAVE_ATTRIBUTE_WEAK
} // namespace internal
} // namespace protobuf

@ -70,6 +70,7 @@ class DescriptorPool; // descriptor.h
class MessageLite; // message_lite.h
class Message; // message.h
class MessageFactory; // message.h
class Reflection; // message.h
class UnknownFieldSet; // unknown_field_set.h
namespace internal {
class FieldSkipper; // wire_format_lite.h
@ -544,6 +545,8 @@ class PROTOBUF_EXPORT ExtensionSet {
template <typename Type, bool IsValid(int)>
friend class RepeatedEnumTypeTraits;
friend class google::protobuf::Reflection;
const int32_t& GetRefInt32(int number, const int32_t& default_value) const;
const int64_t& GetRefInt64(int number, const int64_t& default_value) const;
const uint32_t& GetRefUInt32(int number, const uint32_t& default_value) const;
@ -806,6 +809,9 @@ class PROTOBUF_EXPORT ExtensionSet {
ExtensionFinder* extension_finder,
MessageSetFieldSkipper* field_skipper);
// Returns true if extension is present and lazy.
bool HasLazy(int number) const;
// Gets the extension with the given number, creating it if it does not
// already exist. Returns true if the extension did not already exist.
bool MaybeNewExtension(int number, const FieldDescriptor* descriptor,

@ -97,7 +97,7 @@ FieldMask::FieldMask(const FieldMask& from)
// @@protoc_insertion_point(copy_constructor:google.protobuf.FieldMask)
}
inline void FieldMask::SharedCtor() {
void FieldMask::SharedCtor() {
}
FieldMask::~FieldMask() {

@ -8,12 +8,12 @@
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3015000
#if PROTOBUF_VERSION < 3017000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
#if 3017003 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
@ -52,7 +52,7 @@ struct PROTOBUF_EXPORT TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern PROTOBUF_EXPORT const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto;
PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto;
PROTOBUF_NAMESPACE_OPEN
class FieldMask;
struct FieldMaskDefaultTypeInternal;
@ -120,7 +120,12 @@ class PROTOBUF_EXPORT FieldMask final :
}
inline void Swap(FieldMask* other) {
if (other == this) return;
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() != nullptr &&
GetOwningArena() == other->GetOwningArena()) {
#else // PROTOBUF_FORCE_COPY_IN_SWAP
if (GetOwningArena() == other->GetOwningArena()) {
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);

@ -248,6 +248,12 @@ UnknownFieldSet* Reflection::MutableUnknownFields(Message* message) const {
->mutable_unknown_fields<UnknownFieldSet>();
}
bool Reflection::IsLazyExtension(const Message& message,
const FieldDescriptor* field) const {
return field->is_extension() &&
GetExtensionSet(message).HasLazy(field->number());
}
bool Reflection::IsLazilyVerifiedLazyField(const FieldDescriptor* field) const {
return field->options().lazy();
}

@ -52,6 +52,8 @@
#include <google/protobuf/map_unittest.pb.h>
#include <google/protobuf/test_util.h>
#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/unittest_mset.pb.h>
#include <google/protobuf/unittest_mset_wire_format.pb.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/testing/googletest.h>
@ -70,6 +72,9 @@ class GeneratedMessageReflectionTestHelper {
const std::vector<const FieldDescriptor*>& fields) {
lhs->GetReflection()->UnsafeShallowSwapFields(lhs, rhs, fields);
}
static bool IsLazyExtension(const Message& msg, const FieldDescriptor* ext) {
return msg.GetReflection()->IsLazyExtension(msg, ext);
}
};
namespace {

@ -266,10 +266,11 @@ inline void TableSerialize(const MessageLite& msg,
SerializeInternal(base, field_table + 1, num_fields, output);
}
uint8_t* SerializeInternalToArray(const uint8_t* base,
const FieldMetadata* table,
int32_t num_fields, bool is_deterministic,
uint8_t* buffer);
PROTOBUF_EXPORT uint8_t* SerializeInternalToArray(const uint8_t* base,
const FieldMetadata* table,
int32_t num_fields,
bool is_deterministic,
uint8_t* buffer);
inline uint8_t* TableSerializeToArray(const MessageLite& msg,
const SerializationTable* table,

@ -297,7 +297,12 @@ inline InlinedStringField::InlinedStringField(
new (get_mutable()) std::string(default_value);
}
inline InlinedStringField::InlinedStringField(Arena* /*arena*/) { Init(); }
inline InlinedStringField::InlinedStringField(Arena* arena) {
Init();
if (arena != nullptr) {
arena->OwnDestructor(get_mutable());
}
}
inline const std::string& InlinedStringField::GetNoArena() const {
return *get_const();

@ -136,8 +136,10 @@
#elif defined(__FreeBSD__)
#include <sys/endian.h> // __BYTE_ORDER
#else
#if !defined(__QNX__)
#include <endian.h> // __BYTE_ORDER
#endif
#endif
#if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \
(defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)) && \
!defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST)
@ -398,13 +400,6 @@ class PROTOBUF_EXPORT CodedInputStream {
// This is unrelated to PushLimit()/PopLimit().
void SetTotalBytesLimit(int total_bytes_limit);
PROTOBUF_DEPRECATED_MSG(
"Please use the single parameter version of SetTotalBytesLimit(). The "
"second parameter is ignored.")
void SetTotalBytesLimit(int total_bytes_limit, int) {
SetTotalBytesLimit(total_bytes_limit);
}
// The Total Bytes Limit minus the Current Position, or -1 if the total bytes
// limit is INT_MAX.
int BytesUntilTotalBytesLimit() const;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save