@@ -2846,8 +2846,9 @@ namespace {
2846
2846
// or the original C type.
2847
2847
clang::QualType ClangType = Decl->getUnderlyingType ();
2848
2848
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);
2851
2852
}
2852
2853
2853
2854
if (!SwiftType)
@@ -2950,6 +2951,7 @@ namespace {
2950
2951
auto name = importedName.getDeclName ().getBaseIdentifier ();
2951
2952
2952
2953
// Create the enum declaration and record it.
2954
+ ImportDiagnosticAdder addDiag (Impl, decl, decl->getLocation ());
2953
2955
StructDecl *errorWrapper = nullptr ;
2954
2956
NominalTypeDecl *result;
2955
2957
auto enumInfo = Impl.getEnumInfo (decl);
@@ -2964,8 +2966,8 @@ namespace {
2964
2966
case EnumKind::Unknown: {
2965
2967
// Compute the underlying type of the enumeration.
2966
2968
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);
2969
2971
if (!underlyingType)
2970
2972
return nullptr ;
2971
2973
@@ -2997,8 +2999,8 @@ namespace {
2997
2999
2998
3000
// Compute the underlying type.
2999
3001
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);
3002
3004
if (!underlyingType)
3003
3005
return nullptr ;
3004
3006
@@ -3929,6 +3931,7 @@ namespace {
3929
3931
auto &clangContext = Impl.getClangASTContext ();
3930
3932
auto type = Impl.importTypeIgnoreIUO (
3931
3933
clangContext.getTagDeclType (clangEnum), ImportTypeKind::Value,
3934
+ ImportDiagnosticAdder (Impl, clangEnum, clangEnum->getLocation ()),
3932
3935
isInSystemModule (dc), Bridgeability::None);
3933
3936
if (!type)
3934
3937
return nullptr ;
@@ -3995,6 +3998,7 @@ namespace {
3995
3998
3996
3999
auto importedType =
3997
4000
Impl.importType (decl->getType (), ImportTypeKind::Variable,
4001
+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
3998
4002
isInSystemModule (dc), Bridgeability::None);
3999
4003
if (!importedType)
4000
4004
return nullptr ;
@@ -4517,6 +4521,7 @@ namespace {
4517
4521
4518
4522
auto importedType =
4519
4523
Impl.importType (decl->getType (), ImportTypeKind::RecordField,
4524
+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
4520
4525
isInSystemModule (dc), Bridgeability::None);
4521
4526
if (!importedType) {
4522
4527
Impl.addImportDiagnostic (
@@ -4643,6 +4648,7 @@ namespace {
4643
4648
Impl.importType (declType,
4644
4649
(isAudited ? ImportTypeKind::AuditedVariable
4645
4650
: ImportTypeKind::Variable),
4651
+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
4646
4652
isInSystemModule (dc), Bridgeability::None);
4647
4653
4648
4654
if (!importedType)
@@ -5844,8 +5850,9 @@ namespace {
5844
5850
clangSuperclassType =
5845
5851
clangCtx.getObjCObjectPointerType (clangSuperclassType);
5846
5852
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);
5849
5856
if (superclassType) {
5850
5857
assert (superclassType->is <ClassType>() ||
5851
5858
superclassType->is <BoundGenericClassType>());
@@ -6439,9 +6446,10 @@ SwiftDeclConverter::importSwiftNewtype(const clang::TypedefNameDecl *decl,
6439
6446
decl, AccessLevel::Public, Loc, name, Loc, None, nullptr , dc);
6440
6447
6441
6448
// Import the type of the underlying storage
6449
+ ImportDiagnosticAdder addImportDiag (Impl, decl, decl->getLocation ());
6442
6450
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);
6445
6453
6446
6454
if (!storedUnderlyingType)
6447
6455
return nullptr ;
@@ -6461,8 +6469,8 @@ SwiftDeclConverter::importSwiftNewtype(const clang::TypedefNameDecl *decl,
6461
6469
6462
6470
// Find a bridged type, which may be different
6463
6471
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);
6466
6474
if (auto objTy = computedPropertyUnderlyingType->getOptionalObjectType ())
6467
6475
computedPropertyUnderlyingType = objTy;
6468
6476
@@ -6721,8 +6729,9 @@ SwiftDeclConverter::importAsOptionSetType(DeclContext *dc, Identifier name,
6721
6729
6722
6730
// Compute the underlying type.
6723
6731
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);
6726
6735
if (!underlyingType)
6727
6736
return nullptr ;
6728
6737
@@ -6941,6 +6950,7 @@ SwiftDeclConverter::getImplicitProperty(ImportedName importedName,
6941
6950
bool isFromSystemModule = isInSystemModule (dc);
6942
6951
auto importedType = Impl.importType (
6943
6952
propertyType, ImportTypeKind::Property,
6953
+ ImportDiagnosticAdder (Impl, getter, getter->getLocation ()),
6944
6954
Impl.shouldAllowNSUIntegerAsInt (isFromSystemModule, getter),
6945
6955
Bridgeability::Full, OTK_ImplicitlyUnwrappedOptional);
6946
6956
if (!importedType)
@@ -8127,6 +8137,7 @@ Optional<GenericParamList *> SwiftDeclConverter::importObjCGenericParams(
8127
8137
clangBound->stripObjCKindOfTypeAndQuals (Impl.getClangASTContext ());
8128
8138
Type superclassType = Impl.importTypeIgnoreIUO (
8129
8139
clang::QualType (unqualifiedClangBound, 0 ), ImportTypeKind::Abstract,
8140
+ ImportDiagnosticAdder (Impl, decl, decl->getLocation ()),
8130
8141
false , Bridgeability::None);
8131
8142
if (!superclassType) {
8132
8143
return None;
0 commit comments