Make Type::getReferences return pointer

This change makes it able to add lookups as one more tree pass,
as it requires to change Type inside of references.

This change require getReferences to become non-const, so from now
we maintain const and non-const versions of recursive pass and getting
dependencies.

Bug: 31827278
Test: mma
Change-Id: I201533db5ca0bd30fbad34ef71ed2bd210c607e4
diff --git a/Interface.cpp b/Interface.cpp
index 8eb5907..7f33928 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -460,11 +460,11 @@
     return true;
 }
 
-std::vector<Reference<Type>> Interface::getReferences() const {
-    std::vector<Reference<Type>> ret;
+std::vector<const Reference<Type>*> Interface::getReferences() const {
+    std::vector<const Reference<Type>*> ret;
 
     if (superType() != nullptr) {
-        ret.push_back(mSuperType);
+        ret.push_back(&mSuperType);
     }
 
     for (const auto* method : methods()) {
@@ -475,8 +475,8 @@
     return ret;
 }
 
-std::vector<ConstantExpression*> Interface::getConstantExpressions() const {
-    std::vector<ConstantExpression*> ret;
+std::vector<const ConstantExpression*> Interface::getConstantExpressions() const {
+    std::vector<const ConstantExpression*> ret;
     for (const auto* method : methods()) {
         const auto& retMethod = method->getConstantExpressions();
         ret.insert(ret.end(), retMethod.begin(), retMethod.end());
@@ -484,7 +484,7 @@
     return ret;
 }
 
-std::vector<Reference<Type>> Interface::getStrongReferences() const {
+std::vector<const Reference<Type>*> Interface::getStrongReferences() const {
     // Interface is a special case as a reference:
     // its definiton must be completed for extension but
     // not necessary for other references.
@@ -492,9 +492,9 @@
     // method declaration appears only in interface, we may assume
     // that all references in method definitions are acyclic.
 
-    std::vector<Reference<Type>> ret;
+    std::vector<const Reference<Type>*> ret;
     if (superType() != nullptr) {
-        ret.push_back(mSuperType);
+        ret.push_back(&mSuperType);
     }
     return ret;
 }