Remove ArrayBase
This is the only place we really make copies of types. Removing it to
make it easier to avoid copy constructors to make it easier to add
invariants to the compiler.
Bug: 201584220
Test: aidl_unittests
Change-Id: I1898e7eeed866b3b175fcecc87a395ec701f75c8
diff --git a/aidl_language.h b/aidl_language.h
index a920dab..205e354 100644
--- a/aidl_language.h
+++ b/aidl_language.h
@@ -381,8 +381,8 @@
vector<unique_ptr<AidlTypeSpecifier>>* type_params, const Comments& comments);
virtual ~AidlTypeSpecifier() = default;
- // Copy of this type which is not an array.
- const AidlTypeSpecifier& ArrayBase() const;
+ // View of this type which is not an array.
+ void ViewAsArrayBase(std::function<void(const AidlTypeSpecifier&)> func) const;
// Returns the full-qualified name of the base type.
// int -> int
@@ -447,10 +447,9 @@
const string unresolved_name_;
string fully_qualified_name_;
- bool is_array_;
+ mutable bool is_array_;
vector<string> split_name_;
const AidlDefinedType* defined_type_ = nullptr; // set when Resolve() for defined types
- mutable shared_ptr<AidlTypeSpecifier> array_base_;
};
// Returns the universal value unaltered.