From 76ba220c38ecb4025f72ac307524973ad9161672 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 28 Feb 2022 17:17:11 -0500 Subject: [PATCH] And an overload for ValidateObjCClassPrefixes(). This version defaults all the options, so folks don't have to pass it. Since Options never had a PROTOC_EXPORT, it isn't immediately clear how well the existing api worked for any shared lib cases, so this should give a simpler api for the basic usage (if anyone wants to use it). --- .../protobuf/compiler/objectivec/objectivec_helpers.cc | 7 +++++++ .../protobuf/compiler/objectivec/objectivec_helpers.h | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 696ea2cc6d..b15f580954 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -1454,6 +1454,13 @@ bool ValidateObjCClassPrefix( } // namespace +bool ValidateObjCClassPrefixes(const std::vector& files, + std::string* out_error) { + // Options's ctor load from the environment. + Options options; + return ValidateObjCClassPrefixes(files, options, out_error); +} + bool ValidateObjCClassPrefixes(const std::vector& files, const Options& generation_options, std::string* out_error) { diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h index 490cb02b9e..d21fed215a 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h @@ -253,7 +253,11 @@ IsProtobufLibraryBundledProtoFile(const FileDescriptor* file); // and the result is false. bool PROTOC_EXPORT ValidateObjCClassPrefixes( const std::vector& files, - const Options& generation_options, std::string* out_error); + const Options& validation_options, std::string* out_error); +// Same was the other ValidateObjCClassPrefixes() calls, but the options all +// come from the environment variables. +bool PROTOC_EXPORT ValidateObjCClassPrefixes( + const std::vector& files, std::string* out_error); // Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform // the input into the expected output.