File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -372,7 +372,7 @@ clang::QualType ClangTypeConverter::visitProtocolType(ProtocolType *type) {
372
372
auto &clangCtx = ClangASTContext;
373
373
374
374
if (!proto->isObjC ())
375
- return getClangIdType (ClangASTContext );
375
+ return clang::QualType ( );
376
376
377
377
assert (!cast_or_null<clang::ObjCProtocolDecl>(proto->getClangDecl ())
378
378
&& " We shouldn't be creating duplicate decls; see `convert`" );
@@ -416,6 +416,8 @@ clang::QualType ClangTypeConverter::visitClassType(ClassType *type) {
416
416
auto &clangCtx = ClangASTContext;
417
417
auto swiftDecl = type->getDecl ();
418
418
419
+ // TODO: [non-objc-class-clang-type-conversion]
420
+ // See the corresponding note in GenClangType.cpp
419
421
if (!swiftDecl->isObjC ())
420
422
return getClangIdType (clangCtx);
421
423
Original file line number Diff line number Diff line change @@ -374,8 +374,13 @@ clang::CanQualType GenClangType::visitProtocolType(CanProtocolType type) {
374
374
auto proto = type->getDecl ();
375
375
auto &clangCtx = getClangASTContext ();
376
376
377
- if (!proto->isObjC ())
378
- return getClangIdType (clangCtx);
377
+ if (!proto->isObjC ()) {
378
+ std::string s;
379
+ llvm::raw_string_ostream err (s);
380
+ err << " Trying to compute the clang type for a non-ObjC protocol type\n " ;
381
+ proto->dump (err);
382
+ llvm::report_fatal_error (err.str ());
383
+ }
379
384
380
385
// Single protocol -> id<Proto>
381
386
clang::IdentifierInfo *name = &clangCtx.Idents .get (proto->getName ().get ());
@@ -410,6 +415,9 @@ clang::CanQualType GenClangType::visitClassType(CanClassType type) {
410
415
auto &clangCtx = getClangASTContext ();
411
416
auto swiftDecl = type->getDecl ();
412
417
418
+ // TODO: [non-objc-class-clang-type-conversion]
419
+ // Crashing here instead of returning a bogus 'id' leads to test failures,
420
+ // which is surprising.
413
421
if (!swiftDecl->isObjC ())
414
422
return getClangIdType (clangCtx);
415
423
You can’t perform that action at this time.
0 commit comments