blob: d570589b3c54dc64b4063c767f06821871008f18 [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 AST_H_
18
19#define AST_H_
20
21#include <android-base/macros.h>
Steven Moreland04dea8d2018-02-06 13:11:24 -080022#include <hidl-hash/Hash.h>
Steven Moreland7ae3d542017-01-18 16:46:01 -080023#include <hidl-util/FQName.h>
Timur Iskhakov891a8662017-08-25 21:53:48 -070024#include <functional>
Steven Morelandd537ab02016-09-12 10:32:01 -070025#include <map>
Andreas Huber737080b2016-08-02 15:38:04 -070026#include <set>
Andreas Hubereb1081f2016-07-28 13:13:24 -070027#include <string>
Andreas Huber70a59e12016-08-16 12:57:01 -070028#include <vector>
Andreas Huberc9410c72016-07-28 12:18:40 -070029
Timur Iskhakovcb0ba522017-07-17 20:01:37 -070030#include "Scope.h"
Andreas Huber881227d2016-08-02 14:20:21 -070031#include "Type.h"
Andreas Huberda51b8e2016-07-28 16:00:57 -070032
Andreas Huberc9410c72016-07-28 12:18:40 -070033namespace android {
34
Andreas Huber5345ec22016-07-29 13:33:27 -070035struct Coordinator;
Timur Iskhakov891a8662017-08-25 21:53:48 -070036struct ConstantExpression;
Steven Moreland4d89ee22019-03-08 13:25:32 -080037struct DocComment;
Timur Iskhakov7fa79f62017-08-09 11:04:54 -070038struct EnumValue;
Andreas Huberc9410c72016-07-28 12:18:40 -070039struct Formatter;
Andreas Huber6cb08cf2016-08-03 15:44:51 -070040struct Interface;
Yifan Honga4b53d02016-10-31 17:29:10 -070041struct Location;
Andreas Huber881227d2016-08-02 14:20:21 -070042struct Method;
Andreas Huber31629bc2016-08-03 09:06:40 -070043struct NamedType;
Timur Iskhakov7fa79f62017-08-09 11:04:54 -070044template <class T>
45struct NamedReference;
46struct Type;
Andreas Huberc9410c72016-07-28 12:18:40 -070047
Neel Mehta55c065e2019-05-31 13:30:12 -070048struct ImportStatement {
49 FQName fqName;
50 Location location;
51};
52
Andreas Huberc9410c72016-07-28 12:18:40 -070053struct AST {
Steven Moreland04dea8d2018-02-06 13:11:24 -080054 AST(const Coordinator* coordinator, const Hash* fileHash);
Andreas Huberc9410c72016-07-28 12:18:40 -070055
Andreas Huber84f89de2016-07-28 15:39:51 -070056 bool setPackage(const char *package);
Neel Mehta55c065e2019-05-31 13:30:12 -070057 bool addImport(const char* import, const Location& location);
Andreas Hubereb1081f2016-07-28 13:13:24 -070058
Andreas Hubera2723d22016-07-29 15:36:07 -070059 // package and version really.
60 FQName package() const;
Steven Moreland19f11b52017-05-12 18:22:21 -070061 bool isInterface() const;
Steven Morelandb47a2622018-07-11 09:04:25 -070062 bool definesInterfaces() const;
Andreas Hubera2723d22016-07-29 15:36:07 -070063
Timur Iskhakov565b0132017-09-06 18:07:11 -070064 // Adds package, version and scope stack to local name
65 FQName makeFullName(const char* localName, Scope* scope) const;
66
67 void addScopedType(NamedType* type, Scope* scope);
Andreas Huberc9410c72016-07-28 12:18:40 -070068
Steven Moreland04dea8d2018-02-06 13:11:24 -080069 const std::string& getFilename() const;
70 const Hash* getFileHash() const;
Andreas Huber0d0f9a22016-08-17 10:26:11 -070071
Neel Mehtaf6293d32019-06-12 17:16:38 -070072 const Coordinator& getCoordinator() const;
73
Timur Iskhakov82c048e2017-09-09 01:20:53 -070074 // Look up local identifier.
75 // It could be plain identifier or enum value as described by lookupEnumValue.
76 LocalIdentifier* lookupLocalIdentifier(const Reference<LocalIdentifier>& ref, Scope* scope);
77
Yifan Hongf24fa852016-09-23 11:03:15 -070078 // Look up an enum value by "FQName:valueName".
Timur Iskhakovcb0ba522017-07-17 20:01:37 -070079 EnumValue* lookupEnumValue(const FQName& fqName, std::string* errorMsg, Scope* scope);
Yifan Hongf24fa852016-09-23 11:03:15 -070080
Andreas Huber5345ec22016-07-29 13:33:27 -070081 // Look up a type by FQName, "pure" names, i.e. those without package
82 // or version are first looked up in the current scope chain.
83 // After that lookup proceeds to imports.
Timur Iskhakovcb0ba522017-07-17 20:01:37 -070084 Type* lookupType(const FQName& fqName, Scope* scope);
Andreas Huber5345ec22016-07-29 13:33:27 -070085
Andreas Huber39fa7182016-08-19 14:27:33 -070086 void addImportedAST(AST *ast);
Andreas Huberc9410c72016-07-28 12:18:40 -070087
Timur Iskhakov33431e62017-08-21 17:31:23 -070088 // Calls all passes after parsing required before
89 // being ready to generate output.
90 status_t postParse();
91
Timur Iskhakov891a8662017-08-25 21:53:48 -070092 // Recursive pass on constant expression tree
93 status_t constantExpressionRecursivePass(
Timur Iskhakov82c048e2017-09-09 01:20:53 -070094 const std::function<status_t(ConstantExpression*)>& func, bool processBeforeDependencies);
Steven Moreland12f0ab12018-11-02 17:27:37 -070095 status_t constantExpressionRecursivePass(
96 const std::function<status_t(const ConstantExpression*)>& func,
97 bool processBeforeDependencies) const;
Timur Iskhakov82c048e2017-09-09 01:20:53 -070098
Yifan Hong0e192c42018-10-23 15:32:19 -070099 // Recursive tree pass that sets ParseStage of all types to newStage.
100 status_t setParseStage(Type::ParseStage oldStage, Type::ParseStage newStage);
101
Timur Iskhakov82c048e2017-09-09 01:20:53 -0700102 // Recursive tree pass that looks up all referenced types
103 status_t lookupTypes();
104
105 // Recursive tree pass that looks up all referenced local identifiers
Steven Moreland12f0ab12018-11-02 17:27:37 -0700106 // and types referenced by constant expressions
107 status_t lookupConstantExpressions();
Timur Iskhakov891a8662017-08-25 21:53:48 -0700108
Timur Iskhakov565b0132017-09-06 18:07:11 -0700109 // Recursive tree pass that validates that all defined types
110 // have unique names in their scopes.
111 status_t validateDefinedTypesUniqueNames() const;
112
Timur Iskhakovcec46c42017-08-09 00:22:02 -0700113 // Recursive tree pass that completes type declarations
114 // that depend on super types
115 status_t resolveInheritance();
116
Steven Moreland12f0ab12018-11-02 17:27:37 -0700117 // Recursive tree pass that validates constant expressions
118 status_t validateConstantExpressions() const;
119
Timur Iskhakovcec46c42017-08-09 00:22:02 -0700120 // Recursive tree pass that evaluates constant expressions
Steven Moreland12f0ab12018-11-02 17:27:37 -0700121 status_t evaluateConstantExpressions();
Timur Iskhakovcec46c42017-08-09 00:22:02 -0700122
123 // Recursive tree pass that validates all type-related
124 // syntax restrictions
125 status_t validate() const;
126
Timur Iskhakov40731af2017-08-24 14:18:35 -0700127 // Recursive tree pass that ensures that type definitions and references
Timur Iskhakov458ca362017-09-12 23:16:03 -0700128 // are acyclic and reorderes type definitions in reversed topological order.
129 status_t topologicalReorder();
Timur Iskhakov77dd65c2017-08-31 22:46:56 -0700130
131 // Recursive tree pass that ensures that constant expressions
132 // are acyclic.
133 status_t checkAcyclicConstantExpressions() const;
Timur Iskhakov40731af2017-08-24 14:18:35 -0700134
Timur Iskhakov041fdfe2017-09-06 15:56:01 -0700135 // Recursive tree pass that checks C++ forward declaration restrictions.
136 status_t checkForwardReferenceRestrictions() const;
137
Andreas Huber308d8a22017-11-06 14:46:52 -0800138 status_t gatherReferencedTypes();
139
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800140 void generateCppSource(Formatter& out) const;
Steven Moreland6d688552017-09-15 11:03:02 -0700141
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800142 void generateInterfaceHeader(Formatter& out) const;
143 void generateHwBinderHeader(Formatter& out) const;
144 void generateStubHeader(Formatter& out) const;
145 void generateProxyHeader(Formatter& out) const;
146 void generatePassthroughHeader(Formatter& out) const;
Andreas Huber85eabdb2016-08-25 11:24:49 -0700147
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800148 void generateCppImplHeader(Formatter& out) const;
149 void generateCppImplSource(Formatter& out) const;
Steven Moreland9a6da7a2017-09-15 16:21:24 -0700150
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800151 void generateCppAdapterHeader(Formatter& out) const;
152 void generateCppAdapterSource(Formatter& out) const;
Steven Moreland5abcf012018-02-08 18:50:18 -0800153
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800154 void generateJava(Formatter& out, const std::string& limitToType) const;
Neel Mehta4b6f4392019-05-09 16:03:47 -0700155 void generateJavaImpl(Formatter& out) const;
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800156 void generateJavaTypes(Formatter& out, const std::string& limitToType) const;
Steven Moreland5abcf012018-02-08 18:50:18 -0800157
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800158 void generateVts(Formatter& out) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700159
Yifan Honge4010112018-10-05 11:44:15 -0700160 void generateDependencies(Formatter& out) const;
Daniel Normancb0d8362019-07-08 11:32:15 -0700161 void generateInheritanceHierarchy(Formatter& out) const;
Yifan Honge4010112018-10-05 11:44:15 -0700162
Neel Mehta55c065e2019-05-31 13:30:12 -0700163 const std::vector<ImportStatement>& getImportStatements() const;
Iliyan Malchev5bb14022016-08-09 15:04:39 -0700164 void getImportedPackages(std::set<FQName> *importSet) const;
Andreas Huberd2943e12016-08-05 11:59:31 -0700165
Yifan Hong40a373d2016-11-30 15:16:47 -0800166 // Run getImportedPackages on this, then run getImportedPackages on
167 // each AST in each package referenced in importSet.
168 void getImportedPackagesHierarchy(std::set<FQName> *importSet) const;
169
Andreas Huber0fa9e392016-08-31 09:05:44 -0700170 bool isJavaCompatible() const;
171
Steven Moreland06a81cf2018-01-17 11:13:46 -0800172 // Warning: this only includes names explicitly referenced in code.
173 // It does not include all names which are imported.
174 //
175 // Currently, there is one valid usecase for this: importing exactly
176 // the names which need to be imported in generated code. If you import
177 // based on getAllImportedNamesGranular instead, you will import things
178 // that aren't actually used in the resultant code.
179 //
Andreas Huber4ba5c972017-11-29 11:06:25 -0800180 // Get transitive closure of imported interface/types. This will add
181 // everything exported by a package even if only a single type from
182 // that package was explicitly imported!
Zhuoyao Zhangc4e10602017-01-27 16:48:05 -0800183 void getAllImportedNames(std::set<FQName> *allImportSet) const;
184
Andreas Huber4ba5c972017-11-29 11:06:25 -0800185 // Get imported types, this includes those explicitly imported as well
186 // as all types defined in imported packages.
187 void getAllImportedNamesGranular(std::set<FQName> *allImportSet) const;
188
Andreas Huber019d21d2016-10-03 12:59:47 -0700189 void appendToExportedTypesVector(
190 std::vector<const Type *> *exportedTypes) const;
191
Yifan Hongbe627b32016-10-28 18:38:56 -0700192 // used by the parser.
193 void addSyntaxError();
194 size_t syntaxErrors() const;
195
Yifan Hongc8934042016-11-17 17:10:52 -0800196 bool isIBase() const;
197
Steven Moreland19f11b52017-05-12 18:22:21 -0700198 // or nullptr if not isInterface
Yifan Hong78b38d12017-02-13 18:14:46 +0000199 const Interface *getInterface() const;
200
Steven Moreland19f11b52017-05-12 18:22:21 -0700201 // types or Interface base name (e.x. Foo)
202 std::string getBaseName() const;
203
Neel Mehta693169b2019-05-29 18:45:25 -0700204 Scope* getMutableRootScope();
205 const Scope& getRootScope() const;
Timur Iskhakovcb0ba522017-07-17 20:01:37 -0700206
Steven Moreland9a6da7a2017-09-15 16:21:24 -0700207 static void generateCppPackageInclude(Formatter& out, const FQName& package,
208 const std::string& klass);
209
Andreas Huber308d8a22017-11-06 14:46:52 -0800210 void addDefinedTypes(std::set<FQName> *definedTypes) const;
211 void addReferencedTypes(std::set<FQName> *referencedTypes) const;
212
Andreas Huber4ba5c972017-11-29 11:06:25 -0800213 void addToImportedNamesGranular(const FQName &fqName);
214
Neel Mehta0ee353f2019-05-30 17:40:29 -0700215 bool addMethod(Method* method, Interface* iface);
216 bool addAllReservedMethodsToInterface(Interface* iface);
217
Steven Moreland4d89ee22019-03-08 13:25:32 -0800218 void setHeader(const DocComment* header);
219 const DocComment* getHeader() const;
220
221 // TODO: Clean up all interface usages of unhandled comments and ensure they are attached to the
222 // right element
223 void addUnhandledComment(const DocComment* docComment);
224 const std::vector<const DocComment*> getUnhandledComments() const;
225
Neel Mehta0ee353f2019-05-30 17:40:29 -0700226 private:
Steven Morelande6d7f092018-02-08 13:25:45 -0800227 const Coordinator* mCoordinator;
Steven Moreland04dea8d2018-02-06 13:11:24 -0800228 const Hash* mFileHash;
Andreas Huberc9410c72016-07-28 12:18:40 -0700229
Steven Moreland0ecc7b82017-07-19 12:59:23 -0700230 RootScope mRootScope;
Andreas Huberc9410c72016-07-28 12:18:40 -0700231
Andreas Huberda51b8e2016-07-28 16:00:57 -0700232 FQName mPackage;
Andreas Huber84f89de2016-07-28 15:39:51 -0700233
Steven Moreland4d89ee22019-03-08 13:25:32 -0800234 // Header for the file
235 const DocComment* mHeader = nullptr;
236
237 // A list of trailing DocComments.
238 std::vector<const DocComment*> mUnhandledComments;
239
Neel Mehta55c065e2019-05-31 13:30:12 -0700240 // A list of the FQNames present in the import statements
241 std::vector<ImportStatement> mImportStatements;
242
Andreas Huber39fa7182016-08-19 14:27:33 -0700243 // A set of all external interfaces/types that are _actually_ referenced
244 // in this AST, this is a subset of those specified in import statements.
Andreas Huber4ba5c972017-11-29 11:06:25 -0800245 // Note that this set only resolves to the granularity of either an
246 // interface type or a whole package.
Andreas Huber737080b2016-08-02 15:38:04 -0700247 std::set<FQName> mImportedNames;
248
Andreas Huber4ba5c972017-11-29 11:06:25 -0800249 // This is the set of actually imported types.
250 std::set<FQName> mImportedNamesGranular;
251
Steven Moreland06a81cf2018-01-17 11:13:46 -0800252 // Warning: this only includes names explicitly referenced in code.
253 // It does not include all names which are imported.
254 //
Andreas Huber39fa7182016-08-19 14:27:33 -0700255 // A set of all ASTs we explicitly or implicitly (types.hal) import.
256 std::set<AST *> mImportedASTs;
257
Yifan Hong1977ea32016-10-05 12:49:08 -0700258 // If a single type (instead of the whole AST) is imported, the AST will be
259 // present as a key to this map, with the value being a list of types
260 // imported from this AST. If an AST appears in mImportedASTs but not in
261 // mImportedTypes, then the whole AST is imported.
262 std::map<AST *, std::set<Type *>> mImportedTypes;
263
Andreas Huber39fa7182016-08-19 14:27:33 -0700264 // Types keyed by full names defined in this AST.
Steven Morelandd537ab02016-09-12 10:32:01 -0700265 std::map<FQName, Type *> mDefinedTypesByFullName;
Andreas Huber39fa7182016-08-19 14:27:33 -0700266
Neel Mehta0ee353f2019-05-30 17:40:29 -0700267 // contains all the hidl reserved methods part of this AST
268 std::map<std::string, Method*> mAllReservedMethods;
269
Yifan Hongbe627b32016-10-28 18:38:56 -0700270 // used by the parser.
271 size_t mSyntaxErrors = 0;
272
Andreas Huber308d8a22017-11-06 14:46:52 -0800273 std::set<FQName> mReferencedTypeNames;
274
Yifan Hong87ff8232017-01-09 12:07:05 -0800275 // Helper functions for lookupType.
Timur Iskhakovcb0ba522017-07-17 20:01:37 -0700276 Type* lookupTypeLocally(const FQName& fqName, Scope* scope);
Yifan Hong87ff8232017-01-09 12:07:05 -0800277 status_t lookupAutofilledType(const FQName &fqName, Type **returnedType);
278 Type *lookupTypeFromImports(const FQName &fqName);
279
Andreas Huber39fa7182016-08-19 14:27:33 -0700280 // Find a type matching fqName (which may be partial) and if found
281 // return the associated type and fill in the full "matchingName".
282 // Only types defined in this very AST are considered.
283 Type *findDefinedType(const FQName &fqName, FQName *matchingName) const;
284
Andreas Huber881227d2016-08-02 14:20:21 -0700285 void getPackageComponents(std::vector<std::string> *components) const;
286
287 void getPackageAndVersionComponents(
288 std::vector<std::string> *components, bool cpp_compatible) const;
289
Steven Moreland5708edf2016-11-04 15:33:31 +0000290 std::string makeHeaderGuard(const std::string &baseName,
291 bool indicateGenerated = true) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700292 void enterLeaveNamespace(Formatter &out, bool enter) const;
293
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800294 void generateTypeSource(Formatter& out, const std::string& ifaceName) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700295
Yifan Hong068c5522016-10-31 14:07:25 -0700296 // a method, and in which interface is it originally defined.
297 // be careful of the case where method.isHidlReserved(), where interface
298 // is effectively useless.
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800299 using MethodGenerator = std::function<void(const Method*, const Interface*)>;
Steven Morelanda7a421a2016-09-07 08:35:18 -0700300
Steven Moreland0b843772017-06-23 16:33:38 -0700301 void generateTemplatizationLink(Formatter& out) const;
Steven Moreland1a52e822017-07-27 13:56:29 -0700302 void generateCppTag(Formatter& out, const std::string& tag) const;
Steven Moreland0b843772017-06-23 16:33:38 -0700303
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800304 void generateMethods(Formatter& out, const MethodGenerator& gen,
305 bool includeParents = true) const;
306 void generateStubImplMethod(Formatter& out, const std::string& className,
307 const Method* method) const;
Steven Moreland616cf4d2018-10-02 13:52:18 -0700308 void generatePassthroughMethod(Formatter& out, const Method* method, const Interface* superInterface) const;
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800309 void generateStaticProxyMethodSource(Formatter& out, const std::string& className,
Steven Moreland616cf4d2018-10-02 13:52:18 -0700310 const Method* method, const Interface* superInterface) const;
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800311 void generateProxyMethodSource(Formatter& out, const std::string& className,
312 const Method* method, const Interface* superInterface) const;
Steven Moreland9a6da7a2017-09-15 16:21:24 -0700313 void generateAdapterMethod(Formatter& out, const Method* method) const;
Steven Moreland9c387612016-09-07 09:54:26 -0700314
315 void generateFetchSymbol(Formatter &out, const std::string &ifaceName) const;
Iliyan Malchev62c3d182016-08-16 20:33:39 -0700316
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800317 void generateProxySource(Formatter& out, const FQName& fqName) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700318
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800319 void generateStubSource(Formatter& out, const Interface* iface) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700320
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800321 void generateStubSourceForMethod(Formatter& out, const Method* method,
322 const Interface* superInterface) const;
323 void generateStaticStubMethodSource(Formatter& out, const FQName& fqName,
Steven Moreland616cf4d2018-10-02 13:52:18 -0700324 const Method* method, const Interface* superInterface) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700325
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800326 void generatePassthroughSource(Formatter& out) const;
Steven Moreland69e7c702016-09-09 11:16:32 -0700327
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800328 void generateInterfaceSource(Formatter& out) const;
Zhuoyao Zhang8f492942016-09-28 14:27:56 -0700329
330 enum InstrumentationEvent {
331 SERVER_API_ENTRY = 0,
332 SERVER_API_EXIT,
333 CLIENT_API_ENTRY,
334 CLIENT_API_EXIT,
335 SYNC_CALLBACK_ENTRY,
336 SYNC_CALLBACK_EXIT,
337 ASYNC_CALLBACK_ENTRY,
338 ASYNC_CALLBACK_EXIT,
Steven Moreland9b1cbdf2016-11-01 12:23:27 -0700339 PASSTHROUGH_ENTRY,
340 PASSTHROUGH_EXIT,
Zhuoyao Zhang8f492942016-09-28 14:27:56 -0700341 };
342
Steven Moreland92a08a72017-07-31 14:57:37 -0700343 void generateCppAtraceCall(
Martijn Coenen7b295242016-11-04 16:52:56 +0100344 Formatter &out,
345 InstrumentationEvent event,
346 const Method *method) const;
347
Steven Moreland92a08a72017-07-31 14:57:37 -0700348 void generateCppInstrumentationCall(
Zhuoyao Zhang8f492942016-09-28 14:27:56 -0700349 Formatter &out,
350 InstrumentationEvent event,
Steven Moreland616cf4d2018-10-02 13:52:18 -0700351 const Method *method,
352 const Interface* superInterface) const;
Zhuoyao Zhang8f492942016-09-28 14:27:56 -0700353
Timur Iskhakov7fa79f62017-08-09 11:04:54 -0700354 void declareCppReaderLocals(Formatter& out, const std::vector<NamedReference<Type>*>& arg,
355 bool forResults) const;
Andreas Hubere7ff2282016-08-16 13:50:03 -0700356
Timur Iskhakov7fa79f62017-08-09 11:04:54 -0700357 void emitCppReaderWriter(Formatter& out, const std::string& parcelObj, bool parcelObjIsPointer,
358 const NamedReference<Type>* arg, bool isReader, Type::ErrorMode mode,
359 bool addPrefixToName) const;
Andreas Huber881227d2016-08-02 14:20:21 -0700360
Timur Iskhakov7fa79f62017-08-09 11:04:54 -0700361 void emitJavaReaderWriter(Formatter& out, const std::string& parcelObj,
362 const NamedReference<Type>* arg, bool isReader,
363 bool addPrefixToName) const;
Andreas Huber2831d512016-08-15 09:33:47 -0700364
Steven Moreland6ec9eb92018-02-16 14:21:49 -0800365 void emitVtsTypeDeclarations(Formatter& out) const;
Andreas Huber70a59e12016-08-16 12:57:01 -0700366
Andreas Huberc9410c72016-07-28 12:18:40 -0700367 DISALLOW_COPY_AND_ASSIGN(AST);
368};
369
370} // namespace android
371
372#endif // AST_H_