Andreas Huber | 1aec397 | 2016-08-26 09:26:32 -0700 | [diff] [blame] | 1 | /* |
| 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 Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 17 | #ifndef AST_H_ |
| 18 | |
| 19 | #define AST_H_ |
| 20 | |
| 21 | #include <android-base/macros.h> |
Steven Moreland | 7ae3d54 | 2017-01-18 16:46:01 -0800 | [diff] [blame] | 22 | #include <hidl-util/FQName.h> |
Steven Moreland | d537ab0 | 2016-09-12 10:32:01 -0700 | [diff] [blame] | 23 | #include <map> |
Andreas Huber | 737080b | 2016-08-02 15:38:04 -0700 | [diff] [blame] | 24 | #include <set> |
Andreas Huber | eb1081f | 2016-07-28 13:13:24 -0700 | [diff] [blame] | 25 | #include <string> |
Andreas Huber | 70a59e1 | 2016-08-16 12:57:01 -0700 | [diff] [blame] | 26 | #include <vector> |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 27 | |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 28 | #include "Scope.h" |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 29 | #include "Type.h" |
Andreas Huber | da51b8e | 2016-07-28 16:00:57 -0700 | [diff] [blame] | 30 | |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 31 | namespace android { |
| 32 | |
Andreas Huber | 5345ec2 | 2016-07-29 13:33:27 -0700 | [diff] [blame] | 33 | struct Coordinator; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 34 | struct Formatter; |
Andreas Huber | 6cb08cf | 2016-08-03 15:44:51 -0700 | [diff] [blame] | 35 | struct Interface; |
Yifan Hong | a4b53d0 | 2016-10-31 17:29:10 -0700 | [diff] [blame] | 36 | struct Location; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 37 | struct Method; |
Andreas Huber | 31629bc | 2016-08-03 09:06:40 -0700 | [diff] [blame] | 38 | struct NamedType; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 39 | struct TypedVar; |
Yifan Hong | f24fa85 | 2016-09-23 11:03:15 -0700 | [diff] [blame] | 40 | struct EnumValue; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 41 | |
| 42 | struct AST { |
Steven Moreland | 28b9b53 | 2017-05-12 17:02:58 -0700 | [diff] [blame] | 43 | AST(const Coordinator *coordinator, const std::string &path); |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 44 | |
Andreas Huber | 84f89de | 2016-07-28 15:39:51 -0700 | [diff] [blame] | 45 | bool setPackage(const char *package); |
| 46 | bool addImport(const char *import); |
Andreas Huber | eb1081f | 2016-07-28 13:13:24 -0700 | [diff] [blame] | 47 | |
Andreas Huber | a2723d2 | 2016-07-29 15:36:07 -0700 | [diff] [blame] | 48 | // package and version really. |
| 49 | FQName package() const; |
Steven Moreland | 19f11b5 | 2017-05-12 18:22:21 -0700 | [diff] [blame] | 50 | bool isInterface() const; |
Andreas Huber | 7c5ddfb | 2016-09-29 13:45:22 -0700 | [diff] [blame] | 51 | bool containsInterfaces() const; |
Andreas Huber | a2723d2 | 2016-07-29 15:36:07 -0700 | [diff] [blame] | 52 | |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 53 | // Returns true iff successful. |
| 54 | bool addTypeDef(const char* localName, Type* type, const Location& location, |
| 55 | std::string* errorMsg, Scope* scope); |
Andreas Huber | 5a54544 | 2016-08-03 10:44:56 -0700 | [diff] [blame] | 56 | |
| 57 | // Returns true iff successful. |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 58 | bool addScopedType(NamedType* type, std::string* errorMsg, Scope* scope); |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 59 | |
Andreas Huber | 0d0f9a2 | 2016-08-17 10:26:11 -0700 | [diff] [blame] | 60 | const std::string &getFilename() const; |
| 61 | |
Yifan Hong | f24fa85 | 2016-09-23 11:03:15 -0700 | [diff] [blame] | 62 | // Look up an enum value by "FQName:valueName". |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 63 | EnumValue* lookupEnumValue(const FQName& fqName, std::string* errorMsg, Scope* scope); |
Yifan Hong | f24fa85 | 2016-09-23 11:03:15 -0700 | [diff] [blame] | 64 | |
Andreas Huber | 5345ec2 | 2016-07-29 13:33:27 -0700 | [diff] [blame] | 65 | // Look up a type by FQName, "pure" names, i.e. those without package |
| 66 | // or version are first looked up in the current scope chain. |
| 67 | // After that lookup proceeds to imports. |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 68 | Type* lookupType(const FQName& fqName, Scope* scope); |
Andreas Huber | 5345ec2 | 2016-07-29 13:33:27 -0700 | [diff] [blame] | 69 | |
Andreas Huber | 39fa718 | 2016-08-19 14:27:33 -0700 | [diff] [blame] | 70 | void addImportedAST(AST *ast); |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 71 | |
Andreas Huber | b82318c | 2016-08-02 14:45:54 -0700 | [diff] [blame] | 72 | status_t generateCpp(const std::string &outputPath) const; |
Steven Moreland | 1cbf036 | 2017-05-09 14:32:53 -0700 | [diff] [blame] | 73 | status_t generateCppHeaders(const std::string &outputPath) const; |
| 74 | status_t generateCppSources(const std::string &outputPath) const; |
Steven Moreland | 9c38761 | 2016-09-07 09:54:26 -0700 | [diff] [blame] | 75 | status_t generateCppImpl(const std::string &outputPath) const; |
Steven Moreland | f2a0f5b | 2017-07-18 20:39:11 -0700 | [diff] [blame] | 76 | status_t generateStubImplHeader(const std::string& outputPath) const; |
| 77 | status_t generateStubImplSource(const std::string& outputPath) const; |
Andreas Huber | 85eabdb | 2016-08-25 11:24:49 -0700 | [diff] [blame] | 78 | |
Andreas Huber | 0fa9e39 | 2016-08-31 09:05:44 -0700 | [diff] [blame] | 79 | status_t generateJava( |
Andreas Huber | d29724f | 2016-09-14 09:33:13 -0700 | [diff] [blame] | 80 | const std::string &outputPath, |
| 81 | const std::string &limitToType) const; |
Andreas Huber | 0fa9e39 | 2016-08-31 09:05:44 -0700 | [diff] [blame] | 82 | |
| 83 | status_t generateJavaTypes( |
Andreas Huber | d29724f | 2016-09-14 09:33:13 -0700 | [diff] [blame] | 84 | const std::string &outputPath, |
| 85 | const std::string &limitToType) const; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 86 | |
Iliyan Malchev | 5bb1402 | 2016-08-09 15:04:39 -0700 | [diff] [blame] | 87 | void getImportedPackages(std::set<FQName> *importSet) const; |
Andreas Huber | d2943e1 | 2016-08-05 11:59:31 -0700 | [diff] [blame] | 88 | |
Yifan Hong | 40a373d | 2016-11-30 15:16:47 -0800 | [diff] [blame] | 89 | // Run getImportedPackages on this, then run getImportedPackages on |
| 90 | // each AST in each package referenced in importSet. |
| 91 | void getImportedPackagesHierarchy(std::set<FQName> *importSet) const; |
| 92 | |
Zhuoyao Zhang | 5158db4 | 2016-08-10 10:25:20 -0700 | [diff] [blame] | 93 | status_t generateVts(const std::string &outputPath) const; |
| 94 | |
Andreas Huber | 0fa9e39 | 2016-08-31 09:05:44 -0700 | [diff] [blame] | 95 | bool isJavaCompatible() const; |
| 96 | |
Iliyan Malchev | ed0509b | 2016-09-07 12:37:11 -0700 | [diff] [blame] | 97 | // Return the set of FQNames for those interfaces and types that are |
| 98 | // actually referenced in the AST, not merely imported. |
Iliyan Malchev | ed0509b | 2016-09-07 12:37:11 -0700 | [diff] [blame] | 99 | const std::set<FQName>& getImportedNames() const { |
| 100 | return mImportedNames; |
| 101 | } |
| 102 | |
Zhuoyao Zhang | c4e1060 | 2017-01-27 16:48:05 -0800 | [diff] [blame] | 103 | // Get transitive closure of imported interface/types. |
| 104 | void getAllImportedNames(std::set<FQName> *allImportSet) const; |
| 105 | |
Andreas Huber | 019d21d | 2016-10-03 12:59:47 -0700 | [diff] [blame] | 106 | void appendToExportedTypesVector( |
| 107 | std::vector<const Type *> *exportedTypes) const; |
| 108 | |
Yifan Hong | be627b3 | 2016-10-28 18:38:56 -0700 | [diff] [blame] | 109 | // used by the parser. |
| 110 | void addSyntaxError(); |
| 111 | size_t syntaxErrors() const; |
| 112 | |
Yifan Hong | c893404 | 2016-11-17 17:10:52 -0800 | [diff] [blame] | 113 | bool isIBase() const; |
| 114 | |
Steven Moreland | 19f11b5 | 2017-05-12 18:22:21 -0700 | [diff] [blame] | 115 | // or nullptr if not isInterface |
Yifan Hong | 78b38d1 | 2017-02-13 18:14:46 +0000 | [diff] [blame] | 116 | const Interface *getInterface() const; |
| 117 | |
Steven Moreland | 19f11b5 | 2017-05-12 18:22:21 -0700 | [diff] [blame] | 118 | // types or Interface base name (e.x. Foo) |
| 119 | std::string getBaseName() const; |
| 120 | |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 121 | Scope* getRootScope(); |
| 122 | |
| 123 | private: |
Steven Moreland | 28b9b53 | 2017-05-12 17:02:58 -0700 | [diff] [blame] | 124 | const Coordinator *mCoordinator; |
Andreas Huber | 0d0f9a2 | 2016-08-17 10:26:11 -0700 | [diff] [blame] | 125 | std::string mPath; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 126 | |
Steven Moreland | 0ecc7b8 | 2017-07-19 12:59:23 -0700 | [diff] [blame] | 127 | RootScope mRootScope; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 128 | |
Andreas Huber | da51b8e | 2016-07-28 16:00:57 -0700 | [diff] [blame] | 129 | FQName mPackage; |
Andreas Huber | 84f89de | 2016-07-28 15:39:51 -0700 | [diff] [blame] | 130 | |
Andreas Huber | 39fa718 | 2016-08-19 14:27:33 -0700 | [diff] [blame] | 131 | // A set of all external interfaces/types that are _actually_ referenced |
| 132 | // in this AST, this is a subset of those specified in import statements. |
Andreas Huber | 737080b | 2016-08-02 15:38:04 -0700 | [diff] [blame] | 133 | std::set<FQName> mImportedNames; |
| 134 | |
Andreas Huber | 39fa718 | 2016-08-19 14:27:33 -0700 | [diff] [blame] | 135 | // A set of all ASTs we explicitly or implicitly (types.hal) import. |
| 136 | std::set<AST *> mImportedASTs; |
| 137 | |
Yifan Hong | 1977ea3 | 2016-10-05 12:49:08 -0700 | [diff] [blame] | 138 | // If a single type (instead of the whole AST) is imported, the AST will be |
| 139 | // present as a key to this map, with the value being a list of types |
| 140 | // imported from this AST. If an AST appears in mImportedASTs but not in |
| 141 | // mImportedTypes, then the whole AST is imported. |
| 142 | std::map<AST *, std::set<Type *>> mImportedTypes; |
| 143 | |
Andreas Huber | 39fa718 | 2016-08-19 14:27:33 -0700 | [diff] [blame] | 144 | // Types keyed by full names defined in this AST. |
Steven Moreland | d537ab0 | 2016-09-12 10:32:01 -0700 | [diff] [blame] | 145 | std::map<FQName, Type *> mDefinedTypesByFullName; |
Andreas Huber | 39fa718 | 2016-08-19 14:27:33 -0700 | [diff] [blame] | 146 | |
Yifan Hong | be627b3 | 2016-10-28 18:38:56 -0700 | [diff] [blame] | 147 | // used by the parser. |
| 148 | size_t mSyntaxErrors = 0; |
| 149 | |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 150 | bool addScopedTypeInternal(NamedType* type, std::string* errorMsg, Scope* scope); |
Andreas Huber | 39fa718 | 2016-08-19 14:27:33 -0700 | [diff] [blame] | 151 | |
Yifan Hong | 87ff823 | 2017-01-09 12:07:05 -0800 | [diff] [blame] | 152 | // Helper functions for lookupType. |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 153 | Type* lookupTypeLocally(const FQName& fqName, Scope* scope); |
Yifan Hong | 87ff823 | 2017-01-09 12:07:05 -0800 | [diff] [blame] | 154 | status_t lookupAutofilledType(const FQName &fqName, Type **returnedType); |
| 155 | Type *lookupTypeFromImports(const FQName &fqName); |
| 156 | |
Andreas Huber | 39fa718 | 2016-08-19 14:27:33 -0700 | [diff] [blame] | 157 | // Find a type matching fqName (which may be partial) and if found |
| 158 | // return the associated type and fill in the full "matchingName". |
| 159 | // Only types defined in this very AST are considered. |
| 160 | Type *findDefinedType(const FQName &fqName, FQName *matchingName) const; |
| 161 | |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 162 | void getPackageComponents(std::vector<std::string> *components) const; |
| 163 | |
| 164 | void getPackageAndVersionComponents( |
| 165 | std::vector<std::string> *components, bool cpp_compatible) const; |
| 166 | |
Steven Moreland | ee88eed | 2016-10-31 17:49:00 -0700 | [diff] [blame] | 167 | static void generateCppPackageInclude( |
| 168 | Formatter &out, |
| 169 | const FQName &package, |
| 170 | const std::string &klass); |
| 171 | |
Steven Moreland | 5708edf | 2016-11-04 15:33:31 +0000 | [diff] [blame] | 172 | std::string makeHeaderGuard(const std::string &baseName, |
| 173 | bool indicateGenerated = true) const; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 174 | void enterLeaveNamespace(Formatter &out, bool enter) const; |
| 175 | |
Steven Moreland | 67f67b4 | 2016-09-29 08:59:02 -0700 | [diff] [blame] | 176 | static void generateCheckNonNull(Formatter &out, const std::string &nonNull); |
| 177 | |
Andreas Huber | b82318c | 2016-08-02 14:45:54 -0700 | [diff] [blame] | 178 | status_t generateInterfaceHeader(const std::string &outputPath) const; |
Steven Moreland | 4078631 | 2016-08-16 10:29:40 -0700 | [diff] [blame] | 179 | status_t generateHwBinderHeader(const std::string &outputPath) const; |
Andreas Huber | b82318c | 2016-08-02 14:45:54 -0700 | [diff] [blame] | 180 | status_t generateStubHeader(const std::string &outputPath) const; |
| 181 | status_t generateProxyHeader(const std::string &outputPath) const; |
Steven Moreland | 69e7c70 | 2016-09-09 11:16:32 -0700 | [diff] [blame] | 182 | status_t generatePassthroughHeader(const std::string &outputPath) const; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 183 | |
| 184 | status_t generateTypeSource( |
| 185 | Formatter &out, const std::string &ifaceName) const; |
| 186 | |
Yifan Hong | 068c552 | 2016-10-31 14:07:25 -0700 | [diff] [blame] | 187 | // a method, and in which interface is it originally defined. |
| 188 | // be careful of the case where method.isHidlReserved(), where interface |
| 189 | // is effectively useless. |
| 190 | using MethodGenerator = std::function<status_t(const Method *, const Interface *)>; |
Steven Moreland | a7a421a | 2016-09-07 08:35:18 -0700 | [diff] [blame] | 191 | |
Steven Moreland | 0b84377 | 2017-06-23 16:33:38 -0700 | [diff] [blame] | 192 | void generateTemplatizationLink(Formatter& out) const; |
Steven Moreland | 1a52e82 | 2017-07-27 13:56:29 -0700 | [diff] [blame^] | 193 | void generateCppTag(Formatter& out, const std::string& tag) const; |
Steven Moreland | 0b84377 | 2017-06-23 16:33:38 -0700 | [diff] [blame] | 194 | |
Yifan Hong | 068c552 | 2016-10-31 14:07:25 -0700 | [diff] [blame] | 195 | status_t generateMethods(Formatter &out, MethodGenerator gen) const; |
Steven Moreland | 9c38761 | 2016-09-07 09:54:26 -0700 | [diff] [blame] | 196 | status_t generateStubImplMethod(Formatter &out, |
| 197 | const std::string &className, |
Yifan Hong | 068c552 | 2016-10-31 14:07:25 -0700 | [diff] [blame] | 198 | const Method *method) const; |
Steven Moreland | 69e7c70 | 2016-09-09 11:16:32 -0700 | [diff] [blame] | 199 | status_t generatePassthroughMethod(Formatter &out, |
Yifan Hong | 068c552 | 2016-10-31 14:07:25 -0700 | [diff] [blame] | 200 | const Method *method) const; |
| 201 | status_t generateProxyMethodSource(Formatter &out, |
Steven Moreland | 69e7c70 | 2016-09-09 11:16:32 -0700 | [diff] [blame] | 202 | const std::string &className, |
| 203 | const Method *method, |
Yifan Hong | 068c552 | 2016-10-31 14:07:25 -0700 | [diff] [blame] | 204 | const Interface *superInterface) const; |
Steven Moreland | 9c38761 | 2016-09-07 09:54:26 -0700 | [diff] [blame] | 205 | |
| 206 | void generateFetchSymbol(Formatter &out, const std::string &ifaceName) const; |
Iliyan Malchev | 62c3d18 | 2016-08-16 20:33:39 -0700 | [diff] [blame] | 207 | |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 208 | status_t generateProxySource( |
Yifan Hong | eefe4f2 | 2017-01-04 15:32:42 -0800 | [diff] [blame] | 209 | Formatter &out, const FQName &fqName) const; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 210 | |
| 211 | status_t generateStubSource( |
Yifan Hong | eefe4f2 | 2017-01-04 15:32:42 -0800 | [diff] [blame] | 212 | Formatter &out, const Interface *iface) const; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 213 | |
| 214 | status_t generateStubSourceForMethod( |
Andreas Huber | 6cb08cf | 2016-08-03 15:44:51 -0700 | [diff] [blame] | 215 | Formatter &out, const Interface *iface, const Method *method) const; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 216 | |
Steven Moreland | 69e7c70 | 2016-09-09 11:16:32 -0700 | [diff] [blame] | 217 | status_t generatePassthroughSource(Formatter &out) const; |
| 218 | |
Yifan Hong | fe95aa2 | 2016-10-19 17:26:45 -0700 | [diff] [blame] | 219 | status_t generateInterfaceSource(Formatter &out) const; |
Zhuoyao Zhang | 8f49294 | 2016-09-28 14:27:56 -0700 | [diff] [blame] | 220 | |
| 221 | enum InstrumentationEvent { |
| 222 | SERVER_API_ENTRY = 0, |
| 223 | SERVER_API_EXIT, |
| 224 | CLIENT_API_ENTRY, |
| 225 | CLIENT_API_EXIT, |
| 226 | SYNC_CALLBACK_ENTRY, |
| 227 | SYNC_CALLBACK_EXIT, |
| 228 | ASYNC_CALLBACK_ENTRY, |
| 229 | ASYNC_CALLBACK_EXIT, |
Steven Moreland | 9b1cbdf | 2016-11-01 12:23:27 -0700 | [diff] [blame] | 230 | PASSTHROUGH_ENTRY, |
| 231 | PASSTHROUGH_EXIT, |
Zhuoyao Zhang | 8f49294 | 2016-09-28 14:27:56 -0700 | [diff] [blame] | 232 | }; |
| 233 | |
Martijn Coenen | 7b29524 | 2016-11-04 16:52:56 +0100 | [diff] [blame] | 234 | status_t generateCppAtraceCall( |
| 235 | Formatter &out, |
| 236 | InstrumentationEvent event, |
| 237 | const Method *method) const; |
| 238 | |
Zhuoyao Zhang | 8f49294 | 2016-09-28 14:27:56 -0700 | [diff] [blame] | 239 | status_t generateCppInstrumentationCall( |
| 240 | Formatter &out, |
| 241 | InstrumentationEvent event, |
Zhuoyao Zhang | 8f49294 | 2016-09-28 14:27:56 -0700 | [diff] [blame] | 242 | const Method *method) const; |
| 243 | |
Andreas Huber | e7ff228 | 2016-08-16 13:50:03 -0700 | [diff] [blame] | 244 | void declareCppReaderLocals( |
Andreas Huber | 5e44a29 | 2016-09-27 14:52:39 -0700 | [diff] [blame] | 245 | Formatter &out, |
| 246 | const std::vector<TypedVar *> &arg, |
| 247 | bool forResults) const; |
Andreas Huber | e7ff228 | 2016-08-16 13:50:03 -0700 | [diff] [blame] | 248 | |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 249 | void emitCppReaderWriter( |
| 250 | Formatter &out, |
| 251 | const std::string &parcelObj, |
| 252 | bool parcelObjIsPointer, |
| 253 | const TypedVar *arg, |
| 254 | bool isReader, |
Andreas Huber | 5e44a29 | 2016-09-27 14:52:39 -0700 | [diff] [blame] | 255 | Type::ErrorMode mode, |
| 256 | bool addPrefixToName) const; |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 257 | |
Yifan Hong | bf459bc | 2016-08-23 16:50:37 -0700 | [diff] [blame] | 258 | void emitCppResolveReferences( |
| 259 | Formatter &out, |
| 260 | const std::string &parcelObj, |
| 261 | bool parcelObjIsPointer, |
| 262 | const TypedVar *arg, |
| 263 | bool isReader, |
| 264 | Type::ErrorMode mode, |
| 265 | bool addPrefixToName) const; |
| 266 | |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 267 | void emitJavaReaderWriter( |
| 268 | Formatter &out, |
| 269 | const std::string &parcelObj, |
| 270 | const TypedVar *arg, |
Yifan Hong | a47eef3 | 2016-12-12 10:38:54 -0800 | [diff] [blame] | 271 | bool isReader, |
| 272 | bool addPrefixToName) const; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 273 | |
Andreas Huber | 881227d | 2016-08-02 14:20:21 -0700 | [diff] [blame] | 274 | status_t emitTypeDeclarations(Formatter &out) const; |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 275 | status_t emitJavaTypeDeclarations(Formatter &out) const; |
Zhuoyao Zhang | 864c771 | 2016-08-16 15:35:28 -0700 | [diff] [blame] | 276 | status_t emitVtsTypeDeclarations(Formatter &out) const; |
Andreas Huber | 70a59e1 | 2016-08-16 12:57:01 -0700 | [diff] [blame] | 277 | |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 278 | DISALLOW_COPY_AND_ASSIGN(AST); |
| 279 | }; |
| 280 | |
| 281 | } // namespace android |
| 282 | |
| 283 | #endif // AST_H_ |