aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/code_generator.cc
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2016-12-02 20:54:35 -0800
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2016-12-05 17:44:39 -0800
commitced8f73ffc89880af353b2e0d8b5dd0c5f75267d (patch)
tree65afbb05bf96d1fb843c17d108686d73e46122c4 /src/google/protobuf/compiler/code_generator.cc
parent4280c2740300f414d95a5f282426f25f5b13e05d (diff)
Add version number to plugin protocol.
Diffstat (limited to 'src/google/protobuf/compiler/code_generator.cc')
-rw-r--r--src/google/protobuf/compiler/code_generator.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/code_generator.cc b/src/google/protobuf/compiler/code_generator.cc
index 6bf101c3..11d0f334 100644
--- a/src/google/protobuf/compiler/code_generator.cc
+++ b/src/google/protobuf/compiler/code_generator.cc
@@ -34,6 +34,7 @@
#include <google/protobuf/compiler/code_generator.h>
+#include <google/protobuf/compiler/plugin.pb.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/descriptor.h>
@@ -89,6 +90,13 @@ void GeneratorContext::ListParsedFiles(
GOOGLE_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles";
}
+void GeneratorContext::GetCompilerVersion(Version* version) const {
+ version->set_major(GOOGLE_PROTOBUF_VERSION / 1000000);
+ version->set_minor(GOOGLE_PROTOBUF_VERSION / 1000 % 1000);
+ version->set_patch(GOOGLE_PROTOBUF_VERSION % 1000);
+ version->set_suffix(GOOGLE_PROTOBUF_VERSION_SUFFIX);
+}
+
// Parses a set of comma-delimited name/value pairs.
void ParseGeneratorParameter(const string& text,
std::vector<std::pair<string, string> >* output) {