@@ -2926,6 +2926,24 @@ class AnyFunctionType : public TypeBase {
29262926 ClangTypeInfo getClangTypeInfo () const ;
29272927 ClangTypeInfo getCanonicalClangTypeInfo () const ;
29282928
2929+ // / Returns true if the function type stores a Clang type that cannot
2930+ // / be derived from its Swift type. Returns false otherwise, including if
2931+ // / the function type is not @convention(c) or @convention(block).
2932+ // /
2933+ // / For example, if you have a function pointer from C getting imported with
2934+ // / the following type:
2935+ // /
2936+ // / @convention(c, cType: "void (*)(size_t (*)(size_t))")
2937+ // / (@convention(c, cType: "size_t (*)(size_t)") (Int) -> Int)) -> Void
2938+ // /
2939+ // / The parameter's function type will have hasNonDerivableClangType() = true,
2940+ // / but the outer function type will have hasNonDerivableClangType() = false,
2941+ // / because the parameter and result type are sufficient to correctly derive
2942+ // / the Clang type for the outer function type. In terms of mangling,
2943+ // / the parameter type's mangling will incorporate the Clang type but the
2944+ // / outer function type's mangling doesn't need to duplicate that information.
2945+ bool hasNonDerivableClangType ();
2946+
29292947 ExtInfo getExtInfo () const {
29302948 return ExtInfo (Bits.AnyFunctionType .ExtInfoBits , getClangTypeInfo ());
29312949 }
@@ -4307,6 +4325,11 @@ class SILFunctionType final
43074325
43084326 ClangTypeInfo getClangTypeInfo () const ;
43094327
4328+ // / Returns true if the function type stores a Clang type that cannot
4329+ // / be derived from its Swift type. Returns false otherwise, including if
4330+ // / the function type is not @convention(c) or @convention(block).
4331+ bool hasNonDerivableClangType ();
4332+
43104333 bool hasSameExtInfoAs (const SILFunctionType *otherFn);
43114334
43124335 // / Given that `this` is a `@differentiable` or `@differentiable(linear)`
0 commit comments