Skip to content

Commit 9592fc3

Browse files
committed
[ClangImporter] Eliminate ImportHint::SwiftNewtypeFromCFPointer
It's no longer substantially different from ImportHint::CFPointer, so just handle the two cases together. No functionality change.
1 parent b34d2c5 commit 9592fc3

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ namespace {
9999

100100
/// The source type is any other pointer type.
101101
OtherPointer,
102-
103-
/// The source type created a new Swift type, using swift_newtype, of an
104-
/// original underlying CFPointer. This distinction is necessary to
105-
/// trigger audit-checking.
106-
SwiftNewtypeFromCFPointer,
107102
};
108103

109104
ImportHintKind Kind;
@@ -141,7 +136,6 @@ namespace {
141136
case ImportHint::ObjCPointer:
142137
case ImportHint::CFunctionPointer:
143138
case ImportHint::OtherPointer:
144-
case ImportHint::SwiftNewtypeFromCFPointer:
145139
case ImportHint::VAList:
146140
return true;
147141
}
@@ -652,10 +646,6 @@ namespace {
652646
Type mappedType = decl->getDeclaredInterfaceType();
653647

654648
if (getSwiftNewtypeAttr(type->getDecl(), Impl.CurrentVersion)) {
655-
if (isCFTypeDecl(type->getDecl())) {
656-
return {mappedType, ImportHint::SwiftNewtypeFromCFPointer};
657-
}
658-
659649
auto underlying = Visit(type->getDecl()->getUnderlyingType());
660650
switch (underlying.Hint) {
661651
case ImportHint::None:
@@ -665,7 +655,6 @@ namespace {
665655
case ImportHint::ObjCPointer:
666656
case ImportHint::CFunctionPointer:
667657
case ImportHint::OtherPointer:
668-
case ImportHint::SwiftNewtypeFromCFPointer:
669658
case ImportHint::VAList:
670659
return {mappedType, underlying.Hint};
671660

@@ -1368,17 +1357,11 @@ static ImportedType adjustTypeForConcreteImport(
13681357
case ImportHint::CFPointer:
13691358
// Wrap CF pointers up as unmanaged types, unless this is an audited
13701359
// context.
1371-
if (!isCFAudited(importKind))
1372-
importedType = getUnmanagedType(impl, importedType);
1373-
break;
1374-
1375-
case ImportHint::SwiftNewtypeFromCFPointer:
1376-
// For types we import as new types in Swift, if the use is CF un-audited,
1377-
// then we have to force it to be unmanaged
13781360
if (!isCFAudited(importKind)) {
1379-
auto underlyingType = importedType->getSwiftNewtypeUnderlyingType();
1380-
if (underlyingType)
1381-
importedType = getUnmanagedType(impl, underlyingType);
1361+
Type underlyingType = importedType->getSwiftNewtypeUnderlyingType();
1362+
if (!underlyingType)
1363+
underlyingType = importedType;
1364+
importedType = getUnmanagedType(impl, underlyingType);
13821365
}
13831366
break;
13841367

0 commit comments

Comments
 (0)