Build AST graph explicitly for simpler post-parsing passes

Puts all of AST parent-child dependencies into a graph.
This change also makes it able to not care about such case:
Type -> (non Type) -> Type (ex. Interface -> Method -> Type)
and to store only Type -> Type relations.

Test: hidl_test
Change-Id: Ic67d9833d9519d7bd6cbae603c556c5bd905167a
diff --git a/Interface.cpp b/Interface.cpp
index f55be18..1f60fdf 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -460,6 +460,21 @@
     return true;
 }
 
+std::vector<Reference<Type>> Interface::getReferences() const {
+    std::vector<Reference<Type>> ret;
+
+    if (superType() != nullptr) {
+        ret.push_back(mSuperType);
+    }
+
+    for (const auto* method : methods()) {
+        const auto& references = method->getReferences();
+        ret.insert(ret.end(), references.begin(), references.end());
+    }
+
+    return ret;
+}
+
 status_t Interface::resolveInheritance() {
     size_t serial = FIRST_CALL_TRANSACTION;
     for (const auto* ancestor : superTypeChain()) {