Skip to content

Commit d6d2189

Browse files
committed
Handle output file maps that use the key "objc-header".
This anachronously-named key is nonetheless still important to accept, or else we'll fail to emit the generated header. Fixes rdar://90900115.
1 parent c3c9b1b commit d6d2189

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/Basic/FileTypes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ ID file_types::lookupTypeForName(StringRef Name) {
6161
#define TYPE(NAME, ID, EXTENSION, FLAGS) \
6262
.Case(NAME, TY_##ID)
6363
#include "swift/Basic/FileTypes.def"
64+
.Case("objc-header", TY_ClangHeader)
6465
.Default(TY_INVALID);
6566
}
6667

test/PrintAsObjC/enums.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
// RUN: %check-in-clang %t/enums.WMO.h
1414
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.WMO.h -include ctypes.h -include CoreFoundation.h
1515

16+
// Ensure that providing the output header path via the supplementary output
17+
// file map also works.
18+
19+
// RUN: echo "{\"%s\": {\"objc-header\": \"%t/enums-supplemental.h\"}}" > %t-output-file-map.json
20+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %s -enable-source-import -typecheck -supplementary-output-file-map %t-output-file-map.json -import-objc-header %S/Inputs/enums.h -disable-objc-attr-requires-foundation-module
21+
// RUN: %FileCheck -check-prefix CHECK-SUPPLEMENTAL %s < %t/enums-supplemental.h
22+
1623
// REQUIRES: objc_interop
1724

1825
import Foundation
@@ -23,6 +30,9 @@ import Foundation
2330
// CHECK-LABEL: enum NegativeValues : int16_t;
2431
// CHECK-LABEL: enum ObjcEnumNamed : NSInteger;
2532

33+
// CHECK-SUPPLEMENTAL: enum NegativeValues : int16_t;
34+
// CHECK-SUPPLEMENTAL: enum ObjcEnumNamed : NSInteger;
35+
2636
// CHECK-LABEL: @interface AnEnumMethod
2737
// CHECK-NEXT: - (enum NegativeValues)takeAndReturnEnum:(enum FooComments)foo SWIFT_WARN_UNUSED_RESULT;
2838
// CHECK-NEXT: - (void)acceptPlainEnum:(enum NSMalformedEnumMissingTypedef)_;

0 commit comments

Comments
 (0)