aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Duff <bduff@google.com>2015-02-21 15:22:43 -0800
committerBrian Duff <bduff@google.com>2015-02-21 15:22:43 -0800
commitc8518963254eb51bd8ec52750c2cc487fa857c72 (patch)
tree8632dc5bf9d7498aa91a4af44749f825dd383e1b /src
parent72b0f4cfbb910909f953c52ba7d097a6b3904cbb (diff)
downloadexternal_protobuf-c8518963254eb51bd8ec52750c2cc487fa857c72.zip
external_protobuf-c8518963254eb51bd8ec52750c2cc487fa857c72.tar.gz
external_protobuf-c8518963254eb51bd8ec52750c2cc487fa857c72.tar.bz2
Expose generate_clear as an option.
I wasn't able to get the clear() method to inline into the constructor when optimizations are on in proguard. As a result, every message has an extra superfluous kept method assuming the app never uses clear() directly. There are a couple of instances where setting this option false is necessary in order to get code dexing successfully without hitting the method limit, e.g. https://goto.google.com/tltzq In this example, I tried turning on the method/inlining/unique and method/inlining/short optimizations before resorting to adding the generate_clear option, but the method count did not decrease. The clear() methods were contributing over a thousand extra methods. Change-Id: If6a9651d6a59cdf70b1040d8248779710ac73105
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/compiler/javanano/javanano_generator.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_generator.cc b/src/google/protobuf/compiler/javanano/javanano_generator.cc
index 96e3e80..99ebe12 100644
--- a/src/google/protobuf/compiler/javanano/javanano_generator.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_generator.cc
@@ -156,6 +156,8 @@ bool JavaNanoGenerator::Generate(const FileDescriptor* file,
params.set_generate_clone(option_value == "true");
} else if (option_name == "generate_intdefs") {
params.set_generate_intdefs(option_value == "true");
+ } else if (option_name == "generate_clear") {
+ params.set_generate_clear(option_value == "true");
} else {
*error = "Ignore unknown javanano generator option: " + option_name;
}