Remove DeclareLocalVariable function am: 61dee6ed5a
Original change: https://android-review.googlesource.com/c/platform/system/tools/aidl/+/1412033
Change-Id: I88a3b899104fc66660fae39e3c2ab205c5917b5d
diff --git a/generate_cpp.cpp b/generate_cpp.cpp
index 6be2121..e510873 100644
--- a/generate_cpp.cpp
+++ b/generate_cpp.cpp
@@ -221,14 +221,6 @@
return NestInNamespaces(std::move(decls), package);
}
-bool DeclareLocalVariable(const AidlArgument& a, StatementBlock* b,
- const AidlTypenames& typenamespaces) {
- string type = CppNameOf(a.GetType(), typenamespaces);
-
- b->AddLiteral(type + " " + BuildVarName(a));
- return true;
-}
-
unique_ptr<Declaration> DefineClientTransaction(const AidlTypenames& typenames,
const AidlInterface& interface,
const AidlMethod& method, const Options& options) {
@@ -512,9 +504,8 @@
// Declare all the parameters now. In the common case, we expect no errors
// in serialization.
for (const unique_ptr<AidlArgument>& a : method.GetArguments()) {
- if (!DeclareLocalVariable(*a, b, typenames)) {
- return false;
- }
+ b->AddLiteral(StringPrintf("%s %s", CppNameOf(a->GetType(), typenames).c_str(),
+ BuildVarName(*a).c_str()));
}
// Declare a variable to hold the return value.