mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
PrintAsClang is supposed to emit declarations in the same order regardless of the compiler’s internal state, but we have repeatedly found that our current criteria are inadequate, resulting in non-functionality-affecting changes to generated header content. Add a diagnostic that’s emitted when this happens soliciting a bug report. Since there *should* be no cases where the compiler fails to order declarations, this diagnostic is never actually emitted. Instead, we test this change by enabling `-verify` on nearly all PrintAsClang tests to make sure they are unaffected. This did demonstrate a missing criterion that only mattered in C++ mode: extensions that varied only in their generic signature were not sorted stably. Add a sort criterion for this.
53 lines
2.4 KiB
Swift
53 lines
2.4 KiB
Swift
// Please keep this file in alphabetical order!
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -target %target-pre-stable-abi-triple -emit-module-path %t/resilient_struct.swiftmodule %S/../Inputs/resilient_struct.swift -enable-library-evolution
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -target %target-pre-stable-abi-triple -emit-module-path %t/resilient_objc_class.swiftmodule %S/../Inputs/resilient_objc_class.swift -I %t -enable-library-evolution -emit-objc-header-path %t/resilient_objc_class.h
|
|
|
|
// RUN: cp %S/Inputs/custom-modules/module.modulemap %t/module.modulemap
|
|
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -target %target-pre-stable-abi-triple %s -module-name resilient -typecheck -verify -emit-objc-header-path %t/resilient.h -I %t -enable-library-evolution
|
|
// RUN: %FileCheck %s --check-prefix=NO-STUBS < %t/resilient.h
|
|
// RUN: %check-in-clang %t/resilient.h -I %t
|
|
|
|
// REQUIRES: objc_interop
|
|
// UNSUPPORTED: OS=iosmac
|
|
// UNSUPPORTED: OS=xros
|
|
|
|
// See also resilient-ancestry.swift, for the stable ABI deployment target test.
|
|
|
|
import Foundation
|
|
import resilient_objc_class
|
|
|
|
// Note: @_fixed_layout on a class only applies to the storage layout and
|
|
// not metadata, which remains resilient.
|
|
|
|
// NO-STUBS-NOT: FixedLayoutNSObjectSubclass
|
|
|
|
// CHECK-LABEL: SWIFT_RESILIENT_CLASS("_TtC9resilient27FixedLayoutNSObjectSubclass")
|
|
// CHECK-NEXT: @interface FixedLayoutNSObjectSubclass : FixedLayoutNSObjectOutsideParent
|
|
// CHECK-NEXT: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
|
// CHECK-NEXT: @end
|
|
|
|
@_fixed_layout
|
|
public class FixedLayoutNSObjectSubclass : FixedLayoutNSObjectOutsideParent {}
|
|
|
|
// NO-STUBS-NOT: ResilientNSObjectSubclass
|
|
|
|
// CHECK-LABEL: SWIFT_RESILIENT_CLASS("_TtC9resilient25ResilientNSObjectSubclass")
|
|
// CHECK-NEXT: @interface ResilientNSObjectSubclass : ResilientNSObjectOutsideParent
|
|
// CHECK-NEXT: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
|
// CHECK-NEXT: @end
|
|
|
|
public class ResilientNSObjectSubclass : ResilientNSObjectOutsideParent {}
|
|
|
|
// NO-STUBS-NOT: RenamedNSObjectSubclass
|
|
|
|
// CHECK-LABEL: SWIFT_RESILIENT_CLASS_NAMED("UnrenamedNSObjectSubclass")
|
|
// CHECK-NEXT: @interface RenamedNSObjectSubclass : ResilientNSObjectOutsideParent
|
|
// CHECK-NEXT: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
|
// CHECK-NEXT: @end
|
|
|
|
@objc(RenamedNSObjectSubclass)
|
|
public class UnrenamedNSObjectSubclass : ResilientNSObjectOutsideParent {}
|