Introduce locals to be read from a parcel ahead of time
so that error handling no longer crosses variable declarations.
Bug: 30570468
Change-Id: I365fec3cc33a8fdcd03a84bcbe05848ba290c475
diff --git a/Interface.cpp b/Interface.cpp
index 42186af..2c65865 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -62,6 +62,9 @@
parcelObj + (parcelObjIsPointer ? "->" : ".");
if (isReader) {
+ out << "{\n";
+ out.indent();
+
const std::string binderName = "_hidl_" + name + "_binder";
out << "::android::sp<::android::hardware::IBinder> "
@@ -81,6 +84,9 @@
<< "::asInterface("
<< binderName
<< ");\n";
+
+ out.unindent();
+ out << "}\n\n";
} else {
out << "_hidl_err = ";
out << parcelObjDeref