Change stringstream name to _aidl_os
Build breaks if a field is named as "os".
Test: build
Change-Id: I0513a208fbbd6c63f0cb9870c93e6adbc0608f0e
diff --git a/aidl_to_cpp_common.cpp b/aidl_to_cpp_common.cpp
index 55b5cab..2856bf1 100644
--- a/aidl_to_cpp_common.cpp
+++ b/aidl_to_cpp_common.cpp
@@ -411,31 +411,31 @@
// Output may look like:
// inline std::string toString() const {
-// std::ostringstream os;
-// os << "MyData{";
-// os << "field1: " << field1;
-// os << ", field2: " << v.field2;
+// std::ostringstream _aidl_os;
+// _aidl_os << "MyData{";
+// _aidl_os << "field1: " << field1;
+// _aidl_os << ", field2: " << v.field2;
// ...
-// os << "}";
-// return os.str();
+// _aidl_os << "}";
+// return _aidl_os.str();
// }
void GenerateToString(CodeWriter& out, const AidlStructuredParcelable& parcelable) {
out << "inline std::string toString() const {\n";
out.Indent();
- out << "std::ostringstream os;\n";
- out << "os << \"" << parcelable.GetName() << "{\";\n";
+ out << "std::ostringstream _aidl_os;\n";
+ out << "_aidl_os << \"" << parcelable.GetName() << "{\";\n";
bool first = true;
for (const auto& f : parcelable.GetFields()) {
if (first) {
- out << "os << \"";
+ out << "_aidl_os << \"";
first = false;
} else {
- out << "os << \", ";
+ out << "_aidl_os << \", ";
}
out << f->GetName() << ": \" << ::android::internal::ToString(" << f->GetName() << ");\n";
}
- out << "os << \"}\";\n";
- out << "return os.str();\n";
+ out << "_aidl_os << \"}\";\n";
+ out << "return _aidl_os.str();\n";
out.Dedent();
out << "}\n";
}