diff options
author | 2016-12-02 20:54:35 -0800 | |
---|---|---|
committer | 2016-12-05 17:44:39 -0800 | |
commit | ced8f73ffc89880af353b2e0d8b5dd0c5f75267d (patch) | |
tree | 65afbb05bf96d1fb843c17d108686d73e46122c4 /src/google/protobuf/compiler/plugin.cc | |
parent | 4280c2740300f414d95a5f282426f25f5b13e05d (diff) |
Add version number to plugin protocol.
Diffstat (limited to 'src/google/protobuf/compiler/plugin.cc')
-rw-r--r-- | src/google/protobuf/compiler/plugin.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc index dcccb3d4..3848101d 100644 --- a/src/google/protobuf/compiler/plugin.cc +++ b/src/google/protobuf/compiler/plugin.cc @@ -63,9 +63,12 @@ namespace compiler { class GeneratorResponseContext : public GeneratorContext { public: GeneratorResponseContext( + const Version& compiler_version, CodeGeneratorResponse* response, const std::vector<const FileDescriptor*>& parsed_files) - : response_(response), parsed_files_(parsed_files) {} + : compiler_version_(compiler_version), + response_(response), + parsed_files_(parsed_files) {} virtual ~GeneratorResponseContext() {} // implements GeneratorContext -------------------------------------- @@ -88,7 +91,12 @@ class GeneratorResponseContext : public GeneratorContext { *output = parsed_files_; } + void GetCompilerVersion(Version* version) const { + *version = compiler_version_; + } + private: + Version compiler_version_; CodeGeneratorResponse* response_; const std::vector<const FileDescriptor*>& parsed_files_; }; @@ -116,7 +124,8 @@ bool GenerateCode(const CodeGeneratorRequest& request, } } - GeneratorResponseContext context(response, parsed_files); + GeneratorResponseContext context( + request.compiler_version(), response, parsed_files); string error; bool succeeded = generator.GenerateAll( |