Files
swift-mirror/test/Serialization/resilience.swift
Slava Pestov 81267ce1db AST: Serialize -enable-resilience flag on the ModuleDecl
Since resilience is a property of the module being compiled,
not decls being accessed, we need to record which types are
resilient as part of the module.

Previously we would only ever look at the @_fixed_layout
attribute on a type. If the flag was not specified, Sema
would slap this attribute on every type that gets validated.

This is wasteful for non-resilient builds, because there
all types get the attribute. It was also apparently wrong,
and I don't fully understand when Sema decides to validate
which decls.

It is much cleaner conceptually to just serialize this flag
with the module, and check for its presence if the
attribute was not found on a type.
2016-01-16 02:23:27 -08:00

23 lines
888 B
Swift

// RUN: rm -rf %t && mkdir %t
// This test checks that we serialize the -enable-resilience flag correctly.
// RUN: %target-swift-frontend -emit-module -o %t %s
// RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience.dump.txt
// RUN: FileCheck -check-prefix=CHECK -check-prefix=NO-RESILIENCE %s < %t/resilience.dump.txt
// RUN: %target-swift-frontend -emit-module -o %t -enable-resilience %s
// RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience2.dump.txt
// RUN: FileCheck -check-prefix=CHECK -check-prefix=RESILIENCE %s < %t/resilience2.dump.txt
// RUN: FileCheck -check-prefix=NEGATIVE %s < %t/resilience2.dump.txt
// CHECK: <MODULE_BLOCK {{.*}}>
// RESILIENCE: <IS_RESILIENT abbrevid={{[0-9]+}}/>
// NO-RESILIENCE-NOT: IS_RESILIENT
// CHECK: </MODULE_BLOCK>
// CHECK-NOT: <MODULE_BLOCK {{.*}}>
// NEGATIVE-NOT: UnknownCode
public func flip() {}