Skip to content

Commit 3498ca8

Browse files
committed
[ClangImporter] Simplify handling of BOOL/Boolean slightly
At least as far as ImportHint was concerned, these two mapped types were being treated the same. No functionality change.
1 parent 0ff871a commit 3498ca8

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ namespace {
7171
/// The source type is 'void'.
7272
Void,
7373

74-
/// The source type is 'BOOL'.
75-
BOOL,
76-
77-
/// The source type is 'Boolean'.
74+
/// The source type is 'BOOL' or 'Boolean' -- a type mapped to Swift's
75+
/// 'Bool'.
7876
Boolean,
7977

8078
/// The source type is an Objective-C class type bridged to a Swift
@@ -129,7 +127,6 @@ namespace {
129127
// See also ClangImporter.cpp's canImportAsOptional.
130128
switch (hint) {
131129
case ImportHint::None:
132-
case ImportHint::BOOL:
133130
case ImportHint::Boolean:
134131
case ImportHint::NSUInteger:
135132
case ImportHint::Void:
@@ -685,7 +682,6 @@ namespace {
685682
case ImportHint::SwiftNewtypeFromCFPointer:
686683
return {mappedType, underlying.Hint};
687684

688-
case ImportHint::BOOL:
689685
case ImportHint::Boolean:
690686
case ImportHint::NSUInteger:
691687
// Toss out the special rules for these types; we still want to
@@ -715,7 +711,7 @@ namespace {
715711

716712
ImportHint hint = ImportHint::None;
717713
if (type->getDecl()->getName() == "BOOL") {
718-
hint = ImportHint::BOOL;
714+
hint = ImportHint::Boolean;
719715
} else if (type->getDecl()->getName() == "Boolean") {
720716
// FIXME: Darwin only?
721717
hint = ImportHint::Boolean;
@@ -1381,8 +1377,8 @@ static ImportedType adjustTypeForConcreteImport(
13811377

13821378
// Turn BOOL and DarwinBoolean into Bool in contexts that can bridge types
13831379
// losslessly.
1384-
if ((hint == ImportHint::BOOL || hint == ImportHint::Boolean) &&
1385-
bridging == Bridgeability::Full && canBridgeTypes(importKind)) {
1380+
if (hint == ImportHint::Boolean && bridging == Bridgeability::Full &&
1381+
canBridgeTypes(importKind)) {
13861382
return {impl.SwiftContext.getBoolDecl()->getDeclaredType(), false};
13871383
}
13881384

0 commit comments

Comments
 (0)