Skip to content

Handle output file maps that use the key "objc-header". #42061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Basic/FileTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ID file_types::lookupTypeForName(StringRef Name) {
#define TYPE(NAME, ID, EXTENSION, FLAGS) \
.Case(NAME, TY_##ID)
#include "swift/Basic/FileTypes.def"
.Case("objc-header", TY_ClangHeader)
.Default(TY_INVALID);
}

Expand Down
10 changes: 10 additions & 0 deletions test/PrintAsObjC/enums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
// RUN: %check-in-clang %t/enums.WMO.h
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.WMO.h -include ctypes.h -include CoreFoundation.h

// Ensure that providing the output header path via the supplementary output
// file map also works.

// RUN: echo "{\"%s\": {\"objc-header\": \"%t/enums-supplemental.h\"}}" > %t-output-file-map.json
// 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
// RUN: %FileCheck -check-prefix CHECK-SUPPLEMENTAL %s < %t/enums-supplemental.h

// REQUIRES: objc_interop

import Foundation
Expand All @@ -23,6 +30,9 @@ import Foundation
// CHECK-LABEL: enum NegativeValues : int16_t;
// CHECK-LABEL: enum ObjcEnumNamed : NSInteger;

// CHECK-SUPPLEMENTAL: enum NegativeValues : int16_t;
// CHECK-SUPPLEMENTAL: enum ObjcEnumNamed : NSInteger;

// CHECK-LABEL: @interface AnEnumMethod
// CHECK-NEXT: - (enum NegativeValues)takeAndReturnEnum:(enum FooComments)foo SWIFT_WARN_UNUSED_RESULT;
// CHECK-NEXT: - (void)acceptPlainEnum:(enum NSMalformedEnumMissingTypedef)_;
Expand Down