Change log:9df92afb16..9d565db4c0Full diff:9df92afb16..9d565db4c0Roll chromium third_party 01aaf419f6..5e63803713 Change log:01aaf419f6..5e63803713Changed dependencies: * src/base:6b48dbc0d2..4fcbb21d49* src/build:169887d089..f29a733cc2* src/buildtools:6f4dae280c..5941c1b3df* src/ios:b0428063aa..84fac4e727* src/testing:5951b2830b..04314205f8* src/third_party/boringssl/src: https://boringssl.googlesource.com/boringssl.git/+log/5267ef7b4a..6ff2ba80b7 * src/third_party/catapult: https://chromium.googlesource.com/catapult.git/+log/fdacd1639e..f13bae2df0 * src/third_party/depot_tools:e09b6845cf..79d42dfb11* src/third_party/googletest/src:9077ec7efe..ce468a17c4* src/third_party/libvpx/source/libvpx:37a0283b18..8648a64c83* src/third_party/libyuv:196e2e72a3..780cdfed4e* src/tools:e61dbb7de4..59c08146e7* src/tools/swarming_client:281c390193..9a518d097dDEPS diff:9df92afb16..9d565db4c0/DEPS No update to Clang. TBR=buildbot@webrtc.org,marpan@webrtc.org, BUG=None CQ_INCLUDE_TRYBOTS=master.internal.tryserver.corp.webrtc:linux_internal NO_AUTOIMPORT_DEPS_CHECK=true Change-Id: Ia79e1d33a4a422c50a1802ca6abcd7c60121dfa5 Reviewed-on: https://webrtc-review.googlesource.com/84104 Commit-Queue: WebRTC Buildbot <buildbot@webrtc.org> Reviewed-by: WebRTC Buildbot <buildbot@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23648}
88 lines
3.3 KiB
Diff
88 lines
3.3 KiB
Diff
diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc
|
|
index 60e6fce99d09..bf0fa95be7be 100644
|
|
--- a/src/google/protobuf/compiler/php/php_generator.cc
|
|
+++ b/src/google/protobuf/compiler/php/php_generator.cc
|
|
@@ -165,19 +165,12 @@ std::string NamespacedName(const string& classname,
|
|
|
|
template <typename DescriptorType>
|
|
std::string FullClassName(const DescriptorType* desc, bool is_descriptor) {
|
|
- string classname = desc->name();
|
|
- const Descriptor* containing = desc->containing_type();
|
|
- while (containing != NULL) {
|
|
- classname = containing->name() + '_' + classname;
|
|
- containing = containing->containing_type();
|
|
- }
|
|
- classname = ClassNamePrefix(classname, desc) + classname;
|
|
+ string classname = GeneratedClassName(desc);
|
|
return NamespacedName(classname, desc, is_descriptor);
|
|
}
|
|
|
|
std::string FullClassName(const ServiceDescriptor* desc, bool is_descriptor) {
|
|
- string classname = desc->name();
|
|
- classname = ClassNamePrefix(classname, desc) + classname;
|
|
+ string classname = GeneratedClassName(desc);
|
|
return NamespacedName(classname, desc, is_descriptor);
|
|
}
|
|
|
|
@@ -1369,6 +1362,31 @@ bool Generator::Generate(const FileDescriptor* file, const string& parameter,
|
|
return true;
|
|
}
|
|
|
|
+std::string GeneratedClassName(const Descriptor* desc) {
|
|
+ std::string classname = desc->name();
|
|
+ const Descriptor* containing = desc->containing_type();
|
|
+ while (containing != NULL) {
|
|
+ classname = containing->name() + '_' + classname;
|
|
+ containing = containing->containing_type();
|
|
+ }
|
|
+ return ClassNamePrefix(classname, desc) + classname;
|
|
+}
|
|
+
|
|
+std::string GeneratedClassName(const EnumDescriptor* desc) {
|
|
+ std::string classname = desc->name();
|
|
+ const Descriptor* containing = desc->containing_type();
|
|
+ while (containing != NULL) {
|
|
+ classname = containing->name() + '_' + classname;
|
|
+ containing = containing->containing_type();
|
|
+ }
|
|
+ return ClassNamePrefix(classname, desc) + classname;
|
|
+}
|
|
+
|
|
+std::string GeneratedClassName(const ServiceDescriptor* desc) {
|
|
+ std::string classname = desc->name();
|
|
+ return ClassNamePrefix(classname, desc) + classname;
|
|
+}
|
|
+
|
|
} // namespace php
|
|
} // namespace compiler
|
|
} // namespace protobuf
|
|
diff --git a/src/google/protobuf/compiler/php/php_generator.h b/src/google/protobuf/compiler/php/php_generator.h
|
|
index ce2b000adb1a..67e70bc7b544 100644
|
|
--- a/src/google/protobuf/compiler/php/php_generator.h
|
|
+++ b/src/google/protobuf/compiler/php/php_generator.h
|
|
@@ -32,6 +32,7 @@
|
|
#define GOOGLE_PROTOBUF_COMPILER_PHP_GENERATOR_H__
|
|
|
|
#include <google/protobuf/compiler/code_generator.h>
|
|
+#include <google/protobuf/descriptor.h>
|
|
|
|
#include <string>
|
|
|
|
@@ -47,8 +48,16 @@ class LIBPROTOC_EXPORT Generator
|
|
const string& parameter,
|
|
GeneratorContext* generator_context,
|
|
string* error) const;
|
|
+
|
|
};
|
|
|
|
+// To skip reserved keywords in php, some generated classname are prefixed.
|
|
+// Other code generators may need following API to figure out the actual
|
|
+// classname.
|
|
+std::string GeneratedClassName(const google::protobuf::Descriptor* desc);
|
|
+std::string GeneratedClassName(const google::protobuf::EnumDescriptor* desc);
|
|
+std::string GeneratedClassName(const google::protobuf::ServiceDescriptor* desc);
|
|
+
|
|
} // namespace php
|
|
} // namespace compiler
|
|
} // namespace protobuf
|