| 161 | }; |
| 162 | |
| 163 | static TypeAnnotations GetTypeAnnotations(clang::ASTContext& context, clang::CXXRecordDecl* decl) { |
| 164 | if (!decl->hasDefinition()) { |
| 165 | return {}; |
| 166 | } |
| 167 | |
| 168 | ErrorReporter report_error {context}; |
| 169 | TypeAnnotations ret; |
| 170 | |
| 171 | for (const clang::CXXBaseSpecifier& base : decl->bases()) { |
| 172 | auto annotation = base.getType().getAsString(); |
| 173 | if (annotation == "fexgen::opaque_type") { |
| 174 | ret.is_opaque = true; |
| 175 | } else if (annotation == "fexgen::assume_compatible_data_layout") { |
| 176 | ret.assumed_compatible = true; |
| 177 | } else if (annotation == "fexgen::emit_layout_wrappers") { |
| 178 | ret.emit_layout_wrappers = true; |
| 179 | } else { |
| 180 | throw report_error(base.getSourceRange().getBegin(), "Unknown type annotation"); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | return ret; |
| 185 | } |
| 186 | |
| 187 | static ParameterAnnotations GetParameterAnnotations(clang::ASTContext& context, clang::CXXRecordDecl* decl) { |
| 188 | if (!decl->hasDefinition()) { |