MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / OnAnalysisComplete

Method OnAnalysisComplete

ThunkLibs/Generator/data_layout.cpp:212–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void 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
234TypeCompatibility DataLayoutCompareAction::GetTypeCompatibility(const clang::ASTContext& context, const clang::Type* type,
235 const std::unordered_map<const clang::Type*, TypeInfo> host_abi,

Callers

nothing calls this directly

Calls 6

GetStableLayoutFunction · 0.85
ComputeDataLayoutFunction · 0.85
GetSha256Function · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected