Skip to content

Commit feb76ea

Browse files
[AST] Support SILFunctionType/SILBlockStorageType in ClangTypeConverter.
This is needed before we can store Clang types in SILFunctionType.
1 parent f07ba79 commit feb76ea

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/AST/ClangTypeConverter.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,12 +570,19 @@ clang::QualType ClangTypeConverter::visitFunctionType(FunctionType *type) {
570570
}
571571

572572
clang::QualType ClangTypeConverter::visitSILFunctionType(SILFunctionType *type) {
573-
llvm::report_fatal_error("Expected only AST types but found a SIL function.");
573+
// We must've already computed it before if applicable.
574+
return clang::QualType(type->getClangFunctionType(), 0);
574575
}
575576

576577
clang::QualType
577578
ClangTypeConverter::visitSILBlockStorageType(SILBlockStorageType *type) {
578-
llvm::report_fatal_error("Expected only AST types but found a SIL block.");
579+
// We'll select (void)(^)(). This isn't correct for all blocks, but block
580+
// storage type should only be converted for function signature lowering,
581+
// where the parameter types do not matter.
582+
auto &clangCtx = ClangASTContext;
583+
auto fnTy = clangCtx.getFunctionNoProtoType(clangCtx.VoidTy);
584+
auto blockTy = clangCtx.getBlockPointerType(fnTy);
585+
return clangCtx.getCanonicalType(blockTy);
579586
}
580587

581588
clang::QualType

0 commit comments

Comments
 (0)