blob: 390ffda0a0b7767d8fb56ffa5b92d76d3a1e99d1 [file] [log] [blame]
Andreas Huber1aec3972016-08-26 09:26:32 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Andreas Huberc9410c72016-07-28 12:18:40 -070017#ifndef TYPE_H_
18
19#define TYPE_H_
20
21#include <android-base/macros.h>
Andreas Huber881227d2016-08-02 14:20:21 -070022#include <utils/Errors.h>
Steven Moreland979e0992016-09-07 09:18:08 -070023#include <set>
Timur Iskhakovcec46c42017-08-09 00:22:02 -070024#include <string>
Timur Iskhakov458ca362017-09-12 23:16:03 -070025#include <unordered_map>
Timur Iskhakov33431e62017-08-21 17:31:23 -070026#include <unordered_set>
Timur Iskhakovcec46c42017-08-09 00:22:02 -070027#include <vector>
Andreas Huberc9410c72016-07-28 12:18:40 -070028
Steven Moreland49bad8d2018-05-17 15:45:26 -070029#include "DocComment.h"
Timur Iskhakov505316c2017-08-05 03:38:59 +000030#include "Reference.h"
31
Andreas Huberc9410c72016-07-28 12:18:40 -070032namespace android {
33
Timur Iskhakov891a8662017-08-25 21:53:48 -070034struct ConstantExpression;
Andreas Huberc9410c72016-07-28 12:18:40 -070035struct Formatter;
Steven Moreland979e0992016-09-07 09:18:08 -070036struct FQName;
Timur Iskhakov891a8662017-08-25 21:53:48 -070037struct ScalarType;
Timur Iskhakov63f39902017-08-29 15:47:29 -070038struct Scope;
Andreas Huberc9410c72016-07-28 12:18:40 -070039
Steven Moreland49bad8d2018-05-17 15:45:26 -070040struct Type : DocCommentable {
Neel Mehta3b414a82019-07-02 15:47:48 -070041 Type(Scope* parent, const std::string& definedName);
Andreas Huberc9410c72016-07-28 12:18:40 -070042 virtual ~Type();
43
Andreas Huber709b62d2016-09-19 11:21:18 -070044 virtual bool isArray() const;
Yifan Hongabf73ee2016-12-05 18:47:00 -080045 virtual bool isBitField() const;
Martijn Coenen99e6beb2016-12-01 15:48:42 +010046 virtual bool isCompoundType() const;
47 virtual bool isEnum() const;
Yifan Hongabf73ee2016-12-05 18:47:00 -080048 virtual bool isHandle() const;
Martijn Coenen99e6beb2016-12-01 15:48:42 +010049 virtual bool isInterface() const;
50 virtual bool isNamedType() const;
Steven Moreland397b5e12017-06-08 14:02:26 -070051 virtual bool isMemory() const;
Martijn Coenen99e6beb2016-12-01 15:48:42 +010052 virtual bool isPointer() const;
53 virtual bool isScope() const;
Yifan Hongabf73ee2016-12-05 18:47:00 -080054 virtual bool isScalar() const;
55 virtual bool isString() const;
56 virtual bool isTemplatedType() const;
Martijn Coenen99e6beb2016-12-01 15:48:42 +010057 virtual bool isTypeDef() const;
Andreas Huber709b62d2016-09-19 11:21:18 -070058 virtual bool isVector() const;
Neel Mehtad3375f12019-08-19 09:58:46 -070059 virtual bool isFmq() const;
Andreas Huber8d3ac0c2016-08-04 14:49:23 -070060
Timur Iskhakovdbaed332017-08-31 16:33:41 -070061 // Resolves the type by unwrapping typedefs
62 Type* resolve();
63 virtual const Type* resolve() const;
64
Timur Iskhakov33431e62017-08-21 17:31:23 -070065 // All types defined in this type.
Timur Iskhakovb58f4182017-08-29 15:19:24 -070066 std::vector<Type*> getDefinedTypes();
67 virtual std::vector<const Type*> getDefinedTypes() const;
Timur Iskhakov33431e62017-08-21 17:31:23 -070068
69 // All types referenced in this type.
Timur Iskhakovb58f4182017-08-29 15:19:24 -070070 std::vector<Reference<Type>*> getReferences();
71 virtual std::vector<const Reference<Type>*> getReferences() const;
Timur Iskhakov33431e62017-08-21 17:31:23 -070072
Timur Iskhakov891a8662017-08-25 21:53:48 -070073 // All constant expressions referenced in this type.
Timur Iskhakovb58f4182017-08-29 15:19:24 -070074 std::vector<ConstantExpression*> getConstantExpressions();
75 virtual std::vector<const ConstantExpression*> getConstantExpressions() const;
Timur Iskhakov891a8662017-08-25 21:53:48 -070076
Timur Iskhakov40731af2017-08-24 14:18:35 -070077 // All types referenced in this type that must have completed
78 // definiton before being referenced.
Timur Iskhakovb58f4182017-08-29 15:19:24 -070079 std::vector<Reference<Type>*> getStrongReferences();
80 virtual std::vector<const Reference<Type>*> getStrongReferences() const;
Timur Iskhakov40731af2017-08-24 14:18:35 -070081
Yifan Hong0e192c42018-10-23 15:32:19 -070082 // Indicate stage of parsing.
83 enum class ParseStage {
84 // Indicate that the source file is being parsed and this object is being filled.
85 PARSE,
86 // Indicate that all source files are parsed, and program is working on type dependencies
87 // and validation.
88 POST_PARSE,
89 // Indicate that parsing is completed, and program is in code-generation stage.
90 COMPLETED,
91 };
92
Timur Iskhakov33431e62017-08-21 17:31:23 -070093 // Proceeds recursive pass
94 // Makes sure to visit each node only once.
Yifan Hong0e192c42018-10-23 15:32:19 -070095 // If mParseStage < stage, object is not ready for this recursivePass() call
96 // yet, and function will return error.
97 status_t recursivePass(ParseStage stage, const std::function<status_t(Type*)>& func,
Timur Iskhakov33431e62017-08-21 17:31:23 -070098 std::unordered_set<const Type*>* visited);
Yifan Hong0e192c42018-10-23 15:32:19 -070099 status_t recursivePass(ParseStage stage, const std::function<status_t(const Type*)>& func,
Timur Iskhakov33431e62017-08-21 17:31:23 -0700100 std::unordered_set<const Type*>* visited) const;
101
Timur Iskhakovcec46c42017-08-09 00:22:02 -0700102 // Recursive tree pass that completes type declarations
103 // that depend on super types
104 virtual status_t resolveInheritance();
105
Timur Iskhakovcec46c42017-08-09 00:22:02 -0700106 // Recursive tree pass that validates all type-related
107 // syntax restrictions
108 virtual status_t validate() const;
109
Timur Iskhakov40731af2017-08-24 14:18:35 -0700110 // Recursive tree pass checkAcyclic return type.
111 // Stores cycle end for nice error messages.
112 struct CheckAcyclicStatus {
113 CheckAcyclicStatus(status_t status, const Type* cycleEnd = nullptr);
114
115 status_t status;
116
117 // If a cycle is found, stores the end of cycle.
118 // While going back in recursion, this is used to stop printing the cycle.
119 const Type* cycleEnd;
120 };
121
122 // Recursive tree pass that ensures that type definitions and references
Timur Iskhakov458ca362017-09-12 23:16:03 -0700123 // are acyclic and builds reversed topological order of the types.
Timur Iskhakov40731af2017-08-24 14:18:35 -0700124 // If some cases allow using of incomplete types, these cases are to be
125 // declared in Type::getStrongReferences.
Timur Iskhakov458ca362017-09-12 23:16:03 -0700126 CheckAcyclicStatus topologicalOrder(std::unordered_map<const Type*, size_t>* reversedOrder,
127 std::unordered_set<const Type*>* stack) const;
Timur Iskhakov40731af2017-08-24 14:18:35 -0700128
Timur Iskhakov041fdfe2017-09-06 15:56:01 -0700129 // Checks following C++ restriction on forward declaration:
130 // inner struct could be forward declared only inside its parent.
Timur Iskhakov458ca362017-09-12 23:16:03 -0700131 status_t checkForwardReferenceRestrictions(const Reference<Type>& ref) const;
Timur Iskhakov041fdfe2017-09-06 15:56:01 -0700132
Andreas Huber737080b2016-08-02 15:38:04 -0700133 virtual const ScalarType *resolveToScalarType() const;
Andreas Huberc9410c72016-07-28 12:18:40 -0700134
Steven Moreland0ecc7b82017-07-19 12:59:23 -0700135 virtual std::string typeName() const = 0;
Steven Moreland30bb6a82016-11-30 09:18:34 -0800136
Andreas Huber8d3ac0c2016-08-04 14:49:23 -0700137 bool isValidEnumStorageType() const;
Steven Moreland9df52442016-12-12 08:51:14 -0800138 virtual bool isElidableType() const;
Timur Iskhakov5dc72fe2017-09-07 23:13:44 -0700139
Yifan Hongc6752dc2016-12-20 14:00:14 -0800140 virtual bool canCheckEquality() const;
Timur Iskhakov5dc72fe2017-09-07 23:13:44 -0700141 bool canCheckEquality(std::unordered_set<const Type*>* visited) const;
142 virtual bool deepCanCheckEquality(std::unordered_set<const Type*>* visited) const;
Andreas Huber8d3ac0c2016-08-04 14:49:23 -0700143
Yifan Hong0e192c42018-10-23 15:32:19 -0700144 // ParseStage can only be incremented.
145 ParseStage getParseStage() const;
146 void setParseStage(ParseStage stage);
Timur Iskhakov35930c42017-08-28 18:49:54 -0700147
Timur Iskhakov63f39902017-08-29 15:47:29 -0700148 Scope* parent();
Timur Iskhakov041fdfe2017-09-06 15:56:01 -0700149 const Scope* parent() const;
Timur Iskhakov63f39902017-08-29 15:47:29 -0700150
Neel Mehta3b414a82019-07-02 15:47:48 -0700151 const std::string& definedName() const;
152
Andreas Huber881227d2016-08-02 14:20:21 -0700153 enum StorageMode {
154 StorageMode_Stack,
155 StorageMode_Argument,
Martijn Coenenac587892016-11-17 15:14:19 +0100156 StorageMode_Result,
Andreas Huber881227d2016-08-02 14:20:21 -0700157 };
Yifan Hong3b320f82016-11-01 15:15:54 -0700158
Steven Morelande30ee9b2017-05-09 13:31:01 -0700159 // specifyNamespaces: whether to specify namespaces for built-in types
Andreas Huber881227d2016-08-02 14:20:21 -0700160 virtual std::string getCppType(
Steven Moreland979e0992016-09-07 09:18:08 -0700161 StorageMode mode,
Yifan Hong3b320f82016-11-01 15:15:54 -0700162 bool specifyNamespaces) const;
163
164 std::string decorateCppName(
165 const std::string &name,
166 StorageMode mode,
Steven Moreland979e0992016-09-07 09:18:08 -0700167 bool specifyNamespaces) const;
168
Yifan Hong3b320f82016-11-01 15:15:54 -0700169 std::string getCppStackType(bool specifyNamespaces = true) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700170
Yifan Hong3b320f82016-11-01 15:15:54 -0700171 std::string getCppResultType(bool specifyNamespaces = true) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700172
Yifan Hong3b320f82016-11-01 15:15:54 -0700173 std::string getCppArgumentType(bool specifyNamespaces = true) const;
Andreas Huber4c865b72016-09-14 15:26:27 -0700174
Nirav Atreca7a5022018-06-29 20:43:49 -0700175 std::string getCppTypeCast(const std::string& objName,
176 bool specifyNamespaces = true) const;
177
Yifan Hong4ed13472016-11-02 10:44:11 -0700178 // For an array type, dimensionality information will be accumulated at the
179 // end of the returned string.
Andreas Huber4c865b72016-09-14 15:26:27 -0700180 // if forInitializer == true, actual dimensions are included, i.e. [3][5],
181 // otherwise (and by default), they are omitted, i.e. [][].
Yifan Hong4ed13472016-11-02 10:44:11 -0700182 virtual std::string getJavaType(bool forInitializer = false) const;
Andreas Huber4c865b72016-09-14 15:26:27 -0700183
Nirav Atre66842a92018-06-28 18:14:13 -0700184 // Identical to getJavaType() for most types, except: primitives, in which
185 // case the wrapper type is returned, and generics (such as ArrayList<?>),
186 // where the type specialization is omitted to facilitate use of
187 // instanceof or class.isInstance().
188 virtual std::string getJavaTypeClass() const;
189
190 virtual std::string getJavaTypeCast(const std::string& objName) const;
Andreas Huber2831d512016-08-15 09:33:47 -0700191 virtual std::string getJavaSuffix() const;
192
Zhuoyao Zhangc5ea9f52016-10-06 15:05:39 -0700193 virtual std::string getVtsType() const;
Zhuoyao Zhange9667842017-01-19 12:35:32 -0800194 virtual std::string getVtsValueName() const;
Zhuoyao Zhangc5ea9f52016-10-06 15:05:39 -0700195
Andreas Huber881227d2016-08-02 14:20:21 -0700196 enum ErrorMode {
Andreas Huber881227d2016-08-02 14:20:21 -0700197 ErrorMode_Goto,
198 ErrorMode_Break,
Andreas Huber737080b2016-08-02 15:38:04 -0700199 ErrorMode_Return,
Steven Moreland48cc6042019-04-30 11:28:56 -0700200 ErrorMode_ReturnNothing,
Andreas Huber881227d2016-08-02 14:20:21 -0700201 };
202 virtual void emitReaderWriter(
203 Formatter &out,
204 const std::string &name,
205 const std::string &parcelObj,
206 bool parcelObjIsPointer,
207 bool isReader,
208 ErrorMode mode) const;
209
210 virtual void emitReaderWriterEmbedded(
211 Formatter &out,
Andreas Huberf9d49f12016-09-12 14:58:36 -0700212 size_t depth,
Andreas Huber881227d2016-08-02 14:20:21 -0700213 const std::string &name,
Yifan Hongbe2a3732016-10-05 13:33:41 -0700214 const std::string &sanitizedName,
Andreas Huber881227d2016-08-02 14:20:21 -0700215 bool nameIsPointer,
216 const std::string &parcelObj,
217 bool parcelObjIsPointer,
218 bool isReader,
219 ErrorMode mode,
220 const std::string &parentName,
221 const std::string &offsetText) const;
222
Yifan Hongf5cc2f72017-01-04 18:02:34 -0800223 virtual void emitDump(
224 Formatter &out,
225 const std::string &streamName,
226 const std::string &name) const;
227
Yifan Honge45b5302017-02-22 10:49:07 -0800228 virtual void emitJavaDump(
229 Formatter &out,
230 const std::string &streamName,
231 const std::string &name) const;
232
Andreas Huber2831d512016-08-15 09:33:47 -0700233 virtual void emitJavaReaderWriter(
234 Formatter &out,
235 const std::string &parcelObj,
236 const std::string &argName,
237 bool isReader) const;
238
Andreas Huber85eabdb2016-08-25 11:24:49 -0700239 virtual void emitJavaFieldInitializer(
240 Formatter &out,
241 const std::string &fieldName) const;
242
Nirav Atre66842a92018-06-28 18:14:13 -0700243 virtual void emitJavaFieldDefaultInitialValue(
244 Formatter &out,
245 const std::string &declaredFieldName) const;
246
Andreas Huber85eabdb2016-08-25 11:24:49 -0700247 virtual void emitJavaFieldReaderWriter(
248 Formatter &out,
Andreas Huber4c865b72016-09-14 15:26:27 -0700249 size_t depth,
Andreas Huber709b62d2016-09-19 11:21:18 -0700250 const std::string &parcelName,
Andreas Huber85eabdb2016-08-25 11:24:49 -0700251 const std::string &blobName,
252 const std::string &fieldName,
253 const std::string &offset,
254 bool isReader) const;
255
Neel Mehta3b414a82019-07-02 15:47:48 -0700256 virtual void emitHidlDefinition(Formatter& out) const;
257
Steven Moreland368e4602018-02-16 14:21:49 -0800258 virtual void emitTypeDeclarations(Formatter& out) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700259
Steven Moreland8e61c5a2017-11-17 15:55:28 -0800260 virtual void emitGlobalTypeDeclarations(Formatter& out) const;
261
Timur Iskhakovfd3f2502017-09-05 16:25:02 -0700262 // Emit scope C++ forward declaration.
263 // There is no need to forward declare interfaces, as
264 // they are always declared in global scope in dedicated file.
265 virtual void emitTypeForwardDeclaration(Formatter& out) const;
266
Andreas Hubere3f769a2016-10-10 10:54:44 -0700267 // Emit any declarations pertaining to this type that have to be
Steven Moreland09c6ebe2018-10-09 10:15:48 -0700268 // directly in a namespace, i.e. enum class operators.
Steven Moreland4b8f7a12017-11-17 15:39:54 -0800269 // For android.hardware.foo@1.0::*, this will be in namespace
270 // android::hardware::foo::V1_0
Steven Moreland368e4602018-02-16 14:21:49 -0800271 virtual void emitPackageTypeDeclarations(Formatter& out) const;
Andreas Hubere3f769a2016-10-10 10:54:44 -0700272
Steven Moreland09c6ebe2018-10-09 10:15:48 -0700273 // Emit any definitions pertaining to this type that have to be
274 // directly in a namespace. Typically, these are things that are only
275 // used for a small subset of types, so by putting them in the header,
276 // the space cost is moved to the small number of clients that use the
277 // feature.
278 // For android.hardware.foo@1.0::*, this will be in namespace
279 // android::hardware::foo::V1_0
280 virtual void emitPackageTypeHeaderDefinitions(Formatter& out) const;
281
Yifan Hong244e82d2016-11-11 11:13:57 -0800282 // Emit any declarations pertaining to this type that have to be
283 // at global scope for transport, e.g. read/writeEmbeddedTo/FromParcel
Steven Moreland4b8f7a12017-11-17 15:39:54 -0800284 // For android.hardware.foo@1.0::*, this will be in namespace
285 // android::hardware::foo::V1_0
Steven Moreland368e4602018-02-16 14:21:49 -0800286 virtual void emitPackageHwDeclarations(Formatter& out) const;
Yifan Hong244e82d2016-11-11 11:13:57 -0800287
Steven Moreland368e4602018-02-16 14:21:49 -0800288 virtual void emitTypeDefinitions(Formatter& out, const std::string& prefix) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700289
Steven Moreland368e4602018-02-16 14:21:49 -0800290 virtual void emitJavaTypeDeclarations(Formatter& out, bool atTopLevel) const;
Andreas Huber2831d512016-08-15 09:33:47 -0700291
Andreas Huber881227d2016-08-02 14:20:21 -0700292 virtual bool needsEmbeddedReadWrite() const;
293 virtual bool resultNeedsDeref() const;
294
Zhuoyao Zhang5158db42016-08-10 10:25:20 -0700295 // Generates type declaration for vts proto file.
296 // TODO (b/30844146): make it a pure virtual method.
Steven Moreland368e4602018-02-16 14:21:49 -0800297 virtual void emitVtsTypeDeclarations(Formatter& out) const;
Zhuoyao Zhang864c7712016-08-16 15:35:28 -0700298 // Generates type declaration as attribute of method (return value or method
299 // argument) or attribute of compound type for vts proto file.
Steven Moreland368e4602018-02-16 14:21:49 -0800300 virtual void emitVtsAttributeType(Formatter& out) const;
Zhuoyao Zhang5158db42016-08-10 10:25:20 -0700301
Andreas Huber70a59e12016-08-16 12:57:01 -0700302 // Returns true iff this type is supported through the Java backend.
Timur Iskhakov5dc72fe2017-09-07 23:13:44 -0700303 bool isJavaCompatible() const;
304 bool isJavaCompatible(std::unordered_set<const Type*>* visited) const;
305 virtual bool deepIsJavaCompatible(std::unordered_set<const Type*>* visited) const;
306 // Returns true iff type contains pointer
307 // (excluding methods and inner types).
308 bool containsPointer() const;
309 bool containsPointer(std::unordered_set<const Type*>* visited) const;
310 virtual bool deepContainsPointer(std::unordered_set<const Type*>* visited) const;
311
Andreas Huber85eabdb2016-08-25 11:24:49 -0700312 virtual void getAlignmentAndSize(size_t *align, size_t *size) const;
313
Andreas Huber019d21d2016-10-03 12:59:47 -0700314 virtual void appendToExportedTypesVector(
315 std::vector<const Type *> *exportedTypes) const;
316
Steven Moreland368e4602018-02-16 14:21:49 -0800317 virtual void emitExportedHeader(Formatter& out, bool forJava) const;
Andreas Huber019d21d2016-10-03 12:59:47 -0700318
Timur Iskhakovff5e64a2017-09-11 14:56:18 -0700319 virtual bool isNeverStrongReference() const;
320
Steven Moreland48cc6042019-04-30 11:28:56 -0700321 static void handleError(Formatter &out, ErrorMode mode);
Timur Iskhakovff5e64a2017-09-11 14:56:18 -0700322 protected:
Andreas Huber881227d2016-08-02 14:20:21 -0700323 void emitReaderWriterEmbeddedForTypeName(
324 Formatter &out,
325 const std::string &name,
326 bool nameIsPointer,
327 const std::string &parcelObj,
328 bool parcelObjIsPointer,
329 bool isReader,
330 ErrorMode mode,
331 const std::string &parentName,
332 const std::string &offsetText,
333 const std::string &typeName,
Yifan Hong244e82d2016-11-11 11:13:57 -0800334 const std::string &childName,
335 const std::string &funcNamespace) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700336
Andreas Huber2831d512016-08-15 09:33:47 -0700337 void emitJavaReaderWriterWithSuffix(
338 Formatter &out,
339 const std::string &parcelObj,
340 const std::string &argName,
341 bool isReader,
342 const std::string &suffix,
343 const std::string &extra) const;
344
Yifan Hongf5cc2f72017-01-04 18:02:34 -0800345 void emitDumpWithMethod(
346 Formatter &out,
347 const std::string &streamName,
348 const std::string &methodName,
349 const std::string &name) const;
350
Neel Mehta3b414a82019-07-02 15:47:48 -0700351 // This is the name given to the type in the hidl file
352 std::string mDefinedName;
353
354 private:
Yifan Hong0e192c42018-10-23 15:32:19 -0700355 ParseStage mParseStage = ParseStage::PARSE;
Timur Iskhakov63f39902017-08-29 15:47:29 -0700356 Scope* const mParent;
Timur Iskhakov35930c42017-08-28 18:49:54 -0700357
Andreas Huberc9410c72016-07-28 12:18:40 -0700358 DISALLOW_COPY_AND_ASSIGN(Type);
359};
360
Yifan Hongbf459bc2016-08-23 16:50:37 -0700361struct TemplatedType : public Type {
Timur Iskhakov505316c2017-08-05 03:38:59 +0000362 void setElementType(const Reference<Type>& elementType);
Timur Iskhakov24e605b2017-08-30 14:02:55 -0700363 const Type* getElementType() const;
Timur Iskhakovcec46c42017-08-09 00:22:02 -0700364
Timur Iskhakov3f1d26e2017-08-30 15:35:53 -0700365 virtual std::string templatedTypeName() const = 0;
366 std::string typeName() const override;
367
Timur Iskhakov33431e62017-08-21 17:31:23 -0700368 bool isTemplatedType() const override;
369
Timur Iskhakov24e605b2017-08-30 14:02:55 -0700370 virtual bool isCompatibleElementType(const Type* elementType) const = 0;
Timur Iskhakov33431e62017-08-21 17:31:23 -0700371
Timur Iskhakovb58f4182017-08-29 15:19:24 -0700372 std::vector<const Reference<Type>*> getReferences() const override;
Timur Iskhakov33431e62017-08-21 17:31:23 -0700373
Timur Iskhakovcec46c42017-08-09 00:22:02 -0700374 virtual status_t validate() const override;
375
Steven Moreland368e4602018-02-16 14:21:49 -0800376 void emitVtsTypeDeclarations(Formatter& out) const override;
377 void emitVtsAttributeType(Formatter& out) const override;
Timur Iskhakov33431e62017-08-21 17:31:23 -0700378
Timur Iskhakovcec46c42017-08-09 00:22:02 -0700379 protected:
Neel Mehta3b414a82019-07-02 15:47:48 -0700380 TemplatedType(Scope* parent, const std::string& definedName);
381 Reference<Type> mElementType;
Timur Iskhakov505316c2017-08-05 03:38:59 +0000382
383 private:
Yifan Hongbf459bc2016-08-23 16:50:37 -0700384 DISALLOW_COPY_AND_ASSIGN(TemplatedType);
385};
386
Andreas Huberc9410c72016-07-28 12:18:40 -0700387} // namespace android
388
389#endif // TYPE_H_
390