Skip to content

Commit 735eda0

Browse files
jrose-applebeccadax
authored andcommitted
[ClangImporter] Handle newly-introduced Clang sugar types (#25522)
And `delete` SwiftTypeConverter::VisitType, so that we find out about these at compile time in the future. rdar://50999584
1 parent 722e7d6 commit 735eda0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,15 @@ namespace {
189189
return IR;
190190
}
191191

192+
ImportResult VisitType(const Type*) = delete;
193+
192194
#define DEPENDENT_TYPE(Class, Base) \
193195
ImportResult Visit##Class##Type(const clang::Class##Type *) { \
194196
llvm_unreachable("Dependent types cannot be converted"); \
195197
}
196198
#define TYPE(Class, Base)
197199
#include "clang/AST/TypeNodes.def"
198-
200+
199201
// Given a loaded type like CInt, look through the type alias sugar that the
200202
// stdlib uses to show the underlying type. We want to import the signature
201203
// of the exit(3) libc function as "func exit(Int32)", not as
@@ -334,6 +336,11 @@ namespace {
334336
llvm_unreachable("Invalid BuiltinType.");
335337
}
336338

339+
ImportResult VisitPipeType(const clang::PipeType *) {
340+
// OpenCL types are not supported in Swift.
341+
return Type();
342+
}
343+
337344
ImportResult VisitComplexType(const clang::ComplexType *type) {
338345
// FIXME: Implement once Complex is in the library.
339346
return Type();
@@ -795,12 +802,11 @@ namespace {
795802
SUGAR_TYPE(SubstTemplateTypeParm)
796803
SUGAR_TYPE(TemplateSpecialization)
797804
SUGAR_TYPE(Auto)
805+
SUGAR_TYPE(DeducedTemplateSpecialization)
798806
SUGAR_TYPE(Adjusted)
799807
SUGAR_TYPE(PackExpansion)
800-
801-
ImportResult VisitAttributedType(const clang::AttributedType *type) {
802-
return Visit(type->desugar());
803-
}
808+
SUGAR_TYPE(Attributed)
809+
SUGAR_TYPE(MacroQualified)
804810

805811
ImportResult VisitDecayedType(const clang::DecayedType *type) {
806812
clang::ASTContext &clangCtx = Impl.getClangASTContext();

0 commit comments

Comments
 (0)