Skip to content

Commit e606727

Browse files
martinboehmezoecarver
authored andcommitted
Duplicate changes to GenClangType in ClangTypeConverter.
See discussion here: swiftlang#30630 (comment)
1 parent fd00bc1 commit e606727

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/AST/ClangTypeConverter.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,19 @@ clang::QualType ClangTypeConverter::visitProtocolType(ProtocolType *type) {
461461
// Metatypes can be converted to Class when they are metatypes for concrete
462462
// classes. https://github.com/apple/swift/pull/27479#discussion_r344418131
463463
clang::QualType ClangTypeConverter::visitMetatypeType(MetatypeType *type) {
464-
return getClangMetatypeType(ClangASTContext);
464+
assert(type->hasRepresentation() &&
465+
"metatype should have been assigned a representation");
466+
switch (type->getRepresentation()) {
467+
case MetatypeRepresentation::Thin:
468+
return ClangASTContext.VoidTy;
469+
470+
case MetatypeRepresentation::Thick:
471+
llvm_unreachable("thick metatypes don't have a corresponding Clang type");
472+
473+
case MetatypeRepresentation::ObjC:
474+
return getClangMetatypeType(ClangASTContext);
475+
}
476+
llvm_unreachable("bad representation");
465477
}
466478

467479
// TODO: [stronger-checking-in-clang-type-conversion]

0 commit comments

Comments
 (0)