mirror of
https://github.com/apple/swift.git
synced 2026-10-24 20:15:56 +02:00
In #90037, ClangImporter is updated to fix the CodeGen target info when using directCC1 mode. This causes some regression on specific platforms for emitPCM actions. EmitPCM action in explicit module build only get a minimal set of the swift flags and on some platforms the minimal flags cannot generate clang driver arguments that can be accepted by ClangImporter. The fix is to not regenerating driver arguments for CodeGen target options when there are no CodeGen is in the RequestedAction. This also saves the unnecessary round trip into clang driver when CodeGenOption is not needed. rdar://181058499
57 lines
2.3 KiB
Swift
57 lines
2.3 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: split-file %s %t
|
|
|
|
// RUN: %swift-frontend-plain -target arm64-apple-ios18 -clang-target arm64-apple-ios26 -scan-dependencies -o %t/deps.json -I %t \
|
|
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -enable-builtin-module \
|
|
// RUN: %t/test.swift -module-name Test -swift-version 5 -experimental-clang-importer-direct-cc1-scan
|
|
|
|
// RUN: %{python} %S/../CAS/Inputs/BuildCommandExtractor.py %t/deps.json A | %FileCheck %s
|
|
// RUN: %{python} %S/../CAS/Inputs/BuildCommandExtractor.py %t/deps.json Test | %FileCheck %s
|
|
// RUN: %{python} %S/../CAS/Inputs/BuildCommandExtractor.py %t/deps.json clang:B > %t/clangB.rsp
|
|
// RUN: %FileCheck %s --input-file %t/clangB.rsp
|
|
|
|
/// ios26 is default to a12 CPU and ios18 is a10 CPU. -Xcc is selecting frontend parsing target options so it should be a12.
|
|
// CHECK: target-cpu
|
|
// CHECK-NEXT: -Xcc
|
|
// CHECK-NEXT: apple-a12
|
|
|
|
// RUN: %{python} %S/../../utils/swift-build-modules.py %swift_frontend_plain %t/deps.json -o %t/Test.cmd
|
|
|
|
// RUN: %swift_frontend_plain @%t/clangB.rsp -dump-clang-diagnostics 2>&1 | %FileCheck %s --check-prefix CLANG-DIAG
|
|
|
|
// CLANG-DIAG-NOT: clang importer driver args:
|
|
|
|
// RUN: %swift-frontend-plain -target arm64-apple-ios18 -clang-target arm64-apple-ios26 \
|
|
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -enable-builtin-module \
|
|
// RUN: %t/test.swift -module-name Test -swift-version 5 -O @%t/Test.cmd -S -o %t/test.s
|
|
|
|
// RUN: %FileCheck %s --check-prefix A10-CODEGEN < %t/test.s
|
|
|
|
//--- A.swiftinterface
|
|
// swift-interface-format-version: 1.0
|
|
// swift-module-flags: -module-name A -O -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -user-module-version 1.0
|
|
public func a() { }
|
|
|
|
//--- module.modulemap
|
|
module B {
|
|
header "b.h"
|
|
export *
|
|
}
|
|
|
|
//--- b.h
|
|
#ifndef __ARM_FEATURE_ATOMICS
|
|
#error should use -clang-target, not -target
|
|
#endif
|
|
|
|
//--- test.swift
|
|
import A
|
|
import B
|
|
|
|
public func cmpxchg_test(_ ptr: Builtin.RawPointer, a: Builtin.Int8) {
|
|
// A10-CODEGEN-LABEL: _$s4Test12cmpxchg_test_1ayBp_Bi8_tF
|
|
// A10-CODEGEN: ldaxrb
|
|
// A10-CODEGEN: stlxrb
|
|
// A10-CODEGEN-NOT: swpalb
|
|
Builtin.atomicrmw_xchg_seqcst_Int8(ptr, a)
|
|
}
|