@@ -2846,8 +2846,9 @@ namespace {
28462846 // or the original C type.
28472847 clang::QualType ClangType = Decl->getUnderlyingType ();
28482848 SwiftType = Impl.importTypeIgnoreIUO (
2849- ClangType, ImportTypeKind::Typedef, isInSystemModule (DC),
2850- getTypedefBridgeability (Decl), OTK_Optional);
2849+ ClangType, ImportTypeKind::Typedef,
2850+ ImportDiagnosticAdder (Impl, Decl, Decl->getLocation ()),
2851+ isInSystemModule (DC), getTypedefBridgeability (Decl), OTK_Optional);
28512852 }
28522853
28532854 if (!SwiftType)
@@ -2950,6 +2951,7 @@ namespace {
29502951 auto name = importedName.getDeclName ().getBaseIdentifier ();
29512952
29522953 // Create the enum declaration and record it.
2954+ ImportDiagnosticAdder addDiag (Impl, decl, decl->getLocation ());
29532955 StructDecl *errorWrapper = nullptr ;
29542956 NominalTypeDecl *result;
29552957 auto enumInfo = Impl.getEnumInfo (decl);
@@ -2964,8 +2966,8 @@ namespace {
29642966 case EnumKind::Unknown: {
29652967 // Compute the underlying type of the enumeration.
29662968 auto underlyingType = Impl.importTypeIgnoreIUO (
2967- decl->getIntegerType (), ImportTypeKind::Enum, isInSystemModule (dc) ,
2968- Bridgeability::None);
2969+ decl->getIntegerType (), ImportTypeKind::Enum, addDiag ,
2970+ isInSystemModule (dc), Bridgeability::None);
29692971 if (!underlyingType)
29702972 return nullptr ;
29712973
@@ -2997,8 +2999,8 @@ namespace {
29972999
29983000 // Compute the underlying type.
29993001 auto underlyingType = Impl.importTypeIgnoreIUO (
3000- decl->getIntegerType (), ImportTypeKind::Enum, isInSystemModule (dc) ,
3001- Bridgeability::None);
3002+ decl->getIntegerType (), ImportTypeKind::Enum, addDiag ,
3003+ isInSystemModule (dc), Bridgeability::None);
30023004 if (!underlyingType)
30033005 return nullptr ;
30043006
@@ -3929,6 +3931,7 @@ namespace {
39293931 auto &clangContext = Impl.getClangASTContext ();
39303932 auto type = Impl.importTypeIgnoreIUO (
39313933 clangContext.getTagDeclType (clangEnum), ImportTypeKind::Value,
3934+ ImportDiagnosticAdder (Impl, clangEnum, clangEnum->getLocation ()),
39323935 isInSystemModule (dc), Bridgeability::None);
39333936 if (!type)
39343937 return nullptr ;
@@ -3995,6 +3998,7 @@ namespace {
39953998
39963999 auto importedType =
39974000 Impl.importType (decl->getType (), ImportTypeKind::Variable,
4001+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
39984002 isInSystemModule (dc), Bridgeability::None);
39994003 if (!importedType)
40004004 return nullptr ;
@@ -4517,6 +4521,7 @@ namespace {
45174521
45184522 auto importedType =
45194523 Impl.importType (decl->getType (), ImportTypeKind::RecordField,
4524+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
45204525 isInSystemModule (dc), Bridgeability::None);
45214526 if (!importedType) {
45224527 Impl.addImportDiagnostic (
@@ -4643,6 +4648,7 @@ namespace {
46434648 Impl.importType (declType,
46444649 (isAudited ? ImportTypeKind::AuditedVariable
46454650 : ImportTypeKind::Variable),
4651+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
46464652 isInSystemModule (dc), Bridgeability::None);
46474653
46484654 if (!importedType)
@@ -5844,8 +5850,9 @@ namespace {
58445850 clangSuperclassType =
58455851 clangCtx.getObjCObjectPointerType (clangSuperclassType);
58465852 superclassType = Impl.importTypeIgnoreIUO (
5847- clangSuperclassType, ImportTypeKind::Abstract, isInSystemModule (dc),
5848- Bridgeability::None);
5853+ clangSuperclassType, ImportTypeKind::Abstract,
5854+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
5855+ isInSystemModule (dc), Bridgeability::None);
58495856 if (superclassType) {
58505857 assert (superclassType->is <ClassType>() ||
58515858 superclassType->is <BoundGenericClassType>());
@@ -6439,9 +6446,10 @@ SwiftDeclConverter::importSwiftNewtype(const clang::TypedefNameDecl *decl,
64396446 decl, AccessLevel::Public, Loc, name, Loc, None, nullptr , dc);
64406447
64416448 // Import the type of the underlying storage
6449+ ImportDiagnosticAdder addImportDiag (Impl, decl, decl->getLocation ());
64426450 auto storedUnderlyingType = Impl.importTypeIgnoreIUO (
6443- decl->getUnderlyingType (), ImportTypeKind::Value, isInSystemModule (dc) ,
6444- Bridgeability::None, OTK_None);
6451+ decl->getUnderlyingType (), ImportTypeKind::Value, addImportDiag ,
6452+ isInSystemModule (dc), Bridgeability::None, OTK_None);
64456453
64466454 if (!storedUnderlyingType)
64476455 return nullptr ;
@@ -6461,8 +6469,8 @@ SwiftDeclConverter::importSwiftNewtype(const clang::TypedefNameDecl *decl,
64616469
64626470 // Find a bridged type, which may be different
64636471 auto computedPropertyUnderlyingType = Impl.importTypeIgnoreIUO (
6464- decl->getUnderlyingType (), ImportTypeKind::Property, isInSystemModule (dc) ,
6465- Bridgeability::Full, OTK_None);
6472+ decl->getUnderlyingType (), ImportTypeKind::Property, addImportDiag ,
6473+ isInSystemModule (dc), Bridgeability::Full, OTK_None);
64666474 if (auto objTy = computedPropertyUnderlyingType->getOptionalObjectType ())
64676475 computedPropertyUnderlyingType = objTy;
64686476
@@ -6721,8 +6729,9 @@ SwiftDeclConverter::importAsOptionSetType(DeclContext *dc, Identifier name,
67216729
67226730 // Compute the underlying type.
67236731 auto underlyingType = Impl.importTypeIgnoreIUO (
6724- decl->getIntegerType (), ImportTypeKind::Enum, isInSystemModule (dc),
6725- Bridgeability::None);
6732+ decl->getIntegerType (), ImportTypeKind::Enum,
6733+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
6734+ isInSystemModule (dc), Bridgeability::None);
67266735 if (!underlyingType)
67276736 return nullptr ;
67286737
@@ -6941,6 +6950,7 @@ SwiftDeclConverter::getImplicitProperty(ImportedName importedName,
69416950 bool isFromSystemModule = isInSystemModule (dc);
69426951 auto importedType = Impl.importType (
69436952 propertyType, ImportTypeKind::Property,
6953+ ImportDiagnosticAdder (Impl, getter, getter->getLocation ()),
69446954 Impl.shouldAllowNSUIntegerAsInt (isFromSystemModule, getter),
69456955 Bridgeability::Full, OTK_ImplicitlyUnwrappedOptional);
69466956 if (!importedType)
@@ -8127,6 +8137,7 @@ Optional<GenericParamList *> SwiftDeclConverter::importObjCGenericParams(
81278137 clangBound->stripObjCKindOfTypeAndQuals (Impl.getClangASTContext ());
81288138 Type superclassType = Impl.importTypeIgnoreIUO (
81298139 clang::QualType (unqualifiedClangBound, 0 ), ImportTypeKind::Abstract,
8140+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
81308141 false , Bridgeability::None);
81318142 if (!superclassType) {
81328143 return None;
0 commit comments