Files
swift-mirror/test/Serialization/search-paths.swift
Jordan Rose 25c6c16064 Add frontend option -no-serialize-debugging-options (#20555)
By default, the frontend tries to figure out if the built module is
likely to be distributed in some way, and uses that to decide whether
to include options that help with debugging (such as local search
paths). There's long been a -serialize-debugging-options that forces
those options to be included even when it looks like a framework is
being built, but the opposite has been absent until now.

Note that both of these options are still /frontend/ options, not
driver options, which means they could still change in the future.
(I'd really like to get to a point where debugging doesn't need to
sniff these options out from the module this way, but there are some
complications we'd need to work out. Swift 1 expediency coming back to
cause trouble again.)

rdar://problem/37954803
2018-11-14 10:10:01 -08:00

52 lines
3.1 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/secret)
// RUN: %target-swift-frontend -emit-module -o %t/secret %S/Inputs/struct_with_operators.swift
// RUN: %empty-directory(%t/Frameworks/has_alias.framework/Modules/has_alias.swiftmodule)
// RUN: %target-swift-frontend -emit-module -o %t/Frameworks/has_alias.framework/Modules/has_alias.swiftmodule/%target-swiftmodule-name %S/Inputs/alias.swift -module-name has_alias
// RUN: %target-swift-frontend -emit-module -o %t -I %t/secret -F %t/Frameworks -Fsystem %t/SystemFrameworks -parse-as-library %S/Inputs/has_xref.swift
// RUN: %target-swift-frontend %s -typecheck -I %t -verify -show-diagnostics-after-fatal
// Try again, treating has_xref as a main file to force serialization to occur.
// RUN: %target-swift-frontend -emit-module -o %t -I %t/secret -F %t/Frameworks -Fsystem %t/SystemFrameworks %S/Inputs/has_xref.swift
// RUN: %target-swift-frontend %s -typecheck -I %t
// RUN: %target-swift-frontend -emit-module -o %t -I %t/secret -F %t/Frameworks -Fsystem %t/SystemFrameworks -parse-as-library %S/Inputs/has_xref.swift -serialize-debugging-options
// RUN: %target-swift-frontend %s -typecheck -I %t
// RUN: %target-swift-frontend -emit-module -o %t -I %t/secret -F %t/Frameworks -Fsystem %t/SystemFrameworks -parse-as-library %S/Inputs/has_xref.swift -application-extension
// RUN: %target-swift-frontend %s -typecheck -I %t
// Make sure -no-serialize-debugging-options has the desired effect.
// RUN: %target-swift-frontend -emit-module -o %t -I %t/secret -F %t/Frameworks -Fsystem %t/SystemFrameworks -parse-as-library %S/Inputs/has_xref.swift -application-extension -no-serialize-debugging-options
// RUN: %target-swift-frontend %s -typecheck -I %t -verify -show-diagnostics-after-fatal
// Make sure we don't end up with duplicate search paths.
// RUN: %target-swiftc_driver -emit-module -o %t/has_xref.swiftmodule -I %t/secret -F %t/Frameworks -Fsystem %t/SystemFrameworks -parse-as-library %S/Inputs/has_xref.swift %S/../Inputs/empty.swift -Xfrontend -serialize-debugging-options
// RUN: %target-swift-frontend %s -typecheck -I %t
// RUN: llvm-bcanalyzer -dump %t/has_xref.swiftmodule | %FileCheck %s
// RUN: %target-swift-frontend %s -emit-module -o %t/main.swiftmodule -I %t -I %t/secret -F %t/Frameworks -Fsystem %t/SystemFrameworks
// RUN: llvm-bcanalyzer -dump %t/main.swiftmodule | %FileCheck %s
import has_xref // expected-error {{missing required modules: 'has_alias', 'struct_with_operators'}}
numeric(42) // expected-error {{use of unresolved identifier 'numeric'}}
// CHECK: <INPUT_BLOCK
// CHECK-NOT: /secret'
// CHECK-NOT: /Frameworks'
// CHECK: <SEARCH_PATH abbrevid={{[0-9]+}} op0=1 op1=0/> blob data = '{{.+}}/Frameworks'
// CHECK-NOT: /secret'
// CHECK-NOT: /Frameworks'
// CHECK-NOT: /SystemFrameworks'
// CHECK: <SEARCH_PATH abbrevid={{[0-9]+}} op0=1 op1=1/> blob data = '{{.+}}/SystemFrameworks'
// CHECK-NOT: /secret'
// CHECK-NOT: /Frameworks'
// CHECK-NOT: /SystemFrameworks'
// CHECK: <SEARCH_PATH abbrevid={{[0-9]+}} op0=0 op1=0/> blob data = '{{.+}}/secret'
// CHECK-NOT: /secret'
// CHECK-NOT: /Frameworks'
// CHECK-NOT: /SystemFrameworks'
// CHECK: </INPUT_BLOCK>