Add is_inherited field for each API in generated .vts file
am: e59c933aa4
Change-Id: I285609bac59edb5e671204676810f87fb034c4f7
diff --git a/Interface.cpp b/Interface.cpp
index dd1c5a0..eaf4ce3 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -899,7 +899,7 @@
}
}
-void Interface::emitVtsMethodDeclaration(Formatter& out) const {
+void Interface::emitVtsMethodDeclaration(Formatter& out, bool isInherited) const {
for (const auto &method : methods()) {
if (method->isHidlReserved()) {
continue;
@@ -908,6 +908,7 @@
out << "api: {\n";
out.indent();
out << "name: \"" << method->name() << "\"\n";
+ out << "is_inherited: " << (isInherited ? "true" : "false") << "\n";
// Generate declaration for each return value.
for (const auto &result : method->results()) {
out << "return_type_hidl: {\n";
diff --git a/Interface.h b/Interface.h
index 0c94c0c..005beff 100644
--- a/Interface.h
+++ b/Interface.h
@@ -127,7 +127,7 @@
void emitVtsAttributeType(Formatter& out) const override;
void emitVtsAttributeDeclaration(Formatter& out) const;
- void emitVtsMethodDeclaration(Formatter& out) const;
+ void emitVtsMethodDeclaration(Formatter& out, bool isInherited) const;
bool hasOnewayMethods() const;
diff --git a/generateVts.cpp b/generateVts.cpp
index 40e08c9..722a656 100644
--- a/generateVts.cpp
+++ b/generateVts.cpp
@@ -78,17 +78,15 @@
out << "interface: {\n";
out.indent();
- std::vector<const Interface *> chain = iface->typeChain();
-
// Generate all the attribute declarations first.
emitVtsTypeDeclarations(out);
// Generate all the method declarations.
- for (auto it = chain.rbegin(); it != chain.rend(); ++it) {
- const Interface *superInterface = *it;
- superInterface->emitVtsMethodDeclaration(out);
+ for (const Interface* superInterface : iface->superTypeChain()) {
+ superInterface->emitVtsMethodDeclaration(out, true /*isInhereted*/);
}
+ iface->emitVtsMethodDeclaration(out, false /*isInhereted*/);
out.unindent();
out << "}\n";
} else {