diff --git a/ThunkLibs/Generator/data_layout.cpp b/ThunkLibs/Generator/data_layout.cpp index 0076a69d7..3955c175d 100644 --- a/ThunkLibs/Generator/data_layout.cpp +++ b/ThunkLibs/Generator/data_layout.cpp @@ -191,10 +191,10 @@ static std::array GetSha256(const std::string& function_name) { }; std::string GetTypeNameWithFixedSizeIntegers(clang::ASTContext& context, clang::QualType type) { - if (type->isBuiltinType()) { + if (type->isBuiltinType() && type->isIntegerType()) { auto size = context.getTypeSize(type); return fmt::format("uint{}_t", size); - } else if (type->isPointerType() && type->getPointeeType()->isBuiltinType() && context.getTypeSize(type->getPointeeType()) > 8) { + } else if (type->isPointerType() && type->getPointeeType()->isBuiltinType() && type->getPointeeType()->isIntegerType() && context.getTypeSize(type->getPointeeType()) > 8) { // TODO: Also apply this path to char-like types auto size = context.getTypeSize(type->getPointeeType()); return fmt::format("uint{}_t*", size); diff --git a/ThunkLibs/Generator/gen.cpp b/ThunkLibs/Generator/gen.cpp index d15cfc03f..c3246a165 100644 --- a/ThunkLibs/Generator/gen.cpp +++ b/ThunkLibs/Generator/gen.cpp @@ -551,10 +551,10 @@ void GenerateThunkLibsAction::OnAnalysisComplete(clang::ASTContext& context) { } auto get_guest_type_name = [this](clang::QualType type) { - if (type->isBuiltinType() && !type->isFloatingType()) { + if (type->isBuiltinType() && type->isIntegerType()) { auto size = guest_abi.at(type.getUnqualifiedType().getAsString()).get_if_simple_or_struct()->size_bits; return get_fixed_size_int_name(type.getTypePtr(), size); - } else if (type->isPointerType() && type->getPointeeType()->isIntegerType() && !type->getPointeeType()->isEnumeralType() && !type->getPointeeType()->isVoidType()) { + } else if (type->isPointerType() && type->getPointeeType()->isBuiltinType() && type->getPointeeType()->isIntegerType() && !type->getPointeeType()->isVoidType()) { auto size = guest_abi.at(type->getPointeeType().getUnqualifiedType().getAsString()).get_if_simple_or_struct()->size_bits; return fmt::format("{}{}*", type->getPointeeType().isConstQualified() ? "const " : "", get_fixed_size_int_name(type->getPointeeType().getTypePtr(), size)); } else {