@@ -39,16 +39,24 @@ getKnownTypeInfo(const TypeDecl *typeDecl, PrimitiveTypeMapping &typeMapping,
39
39
: typeMapping.getKnownCTypeInfo (typeDecl);
40
40
}
41
41
42
- bool isKnownCxxType (Type t, PrimitiveTypeMapping &typeMapping) {
42
+ bool isKnownType (Type t, PrimitiveTypeMapping &typeMapping,
43
+ OutputLanguageMode languageMode) {
43
44
const TypeDecl *typeDecl;
44
45
if (auto *typeAliasType = dyn_cast<TypeAliasType>(t.getPointer ()))
45
46
typeDecl = typeAliasType->getDecl ();
46
47
else if (auto *structDecl = t->getStructOrBoundGenericStruct ())
47
48
typeDecl = structDecl;
48
49
else
49
50
return false ;
50
- return getKnownTypeInfo (typeDecl, typeMapping, OutputLanguageMode::Cxx) !=
51
- None;
51
+ return getKnownTypeInfo (typeDecl, typeMapping, languageMode) != None;
52
+ }
53
+
54
+ bool isKnownCxxType (Type t, PrimitiveTypeMapping &typeMapping) {
55
+ return isKnownType (t, typeMapping, OutputLanguageMode::Cxx);
56
+ }
57
+
58
+ bool isKnownCType (Type t, PrimitiveTypeMapping &typeMapping) {
59
+ return isKnownType (t, typeMapping, OutputLanguageMode::ObjC);
52
60
}
53
61
54
62
// Prints types in the C function signature that corresponds to the
@@ -164,6 +172,7 @@ void DeclAndTypeClangFunctionPrinter::printFunctionSignature(
164
172
// Print out the return type.
165
173
bool isIndirectReturnType =
166
174
kind == FunctionSignatureKind::CFunctionProto &&
175
+ !isKnownCType (resultTy, typeMapping) &&
167
176
interopContext.getIrABIDetails ().shouldReturnIndirectly (resultTy);
168
177
if (!isIndirectReturnType) {
169
178
OptionalTypeKind retKind;
0 commit comments