| 210 | } |
| 211 | |
| 212 | void AnalyzeDataLayoutAction::OnAnalysisComplete(clang::ASTContext& context) { |
| 213 | type_abi = GetStableLayout(context, ComputeDataLayout(context, types)); |
| 214 | |
| 215 | // Register functions that must be guest-callable through host function pointers |
| 216 | for (auto funcptr_type_it = thunked_funcptrs.begin(); funcptr_type_it != thunked_funcptrs.end(); ++funcptr_type_it) { |
| 217 | auto& funcptr_id = funcptr_type_it->first; |
| 218 | auto& [type, param_annotations] = funcptr_type_it->second; |
| 219 | auto func_type = type->getAs<clang::FunctionProtoType>(); |
| 220 | std::string mangled_name = clang::QualType {type, 0}.getAsString(); |
| 221 | auto cb_sha256 = GetSha256("fexcallback_" + mangled_name); |
| 222 | FuncPtrInfo info = {cb_sha256}; |
| 223 | |
| 224 | // TODO: Also apply GetTypeNameWithFixedSizeIntegers here |
| 225 | info.result = func_type->getReturnType().getAsString(); |
| 226 | |
| 227 | for (auto arg : func_type->getParamTypes()) { |
| 228 | info.args.push_back(GetTypeNameWithFixedSizeIntegers(context, arg)); |
| 229 | } |
| 230 | type_abi.thunked_funcptrs[funcptr_id] = std::move(info); |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | TypeCompatibility DataLayoutCompareAction::GetTypeCompatibility(const clang::ASTContext& context, const clang::Type* type, |
| 235 | const std::unordered_map<const clang::Type*, TypeInfo> host_abi, |
nothing calls this directly
no test coverage detected