Skip to content

Commit ea31c04

Browse files
committed
[Driver] -c with LTO should still emit bitcode
1 parent f90f06d commit ea31c04

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/Driver/Driver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,8 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
15011501

15021502
case options::OPT_emit_object:
15031503
OI.CompilerOutputType = file_types::TY_Object;
1504+
if (OI.LTOVariant != OutputInfo::LTOKind::None)
1505+
OI.CompilerOutputType = file_types::TY_LLVM_BC;
15041506
break;
15051507

15061508
case options::OPT_emit_assembly:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// REQUIRES: lld_lto
2+
3+
// RUN: %swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -lto=llvm-full -static -emit-library -target x86_64-apple-macosx10.9 | %FileCheck %s
4+
// RUN: %swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -lto=llvm-full -emit-library -target x86_64-apple-macosx10.9 | %FileCheck %s
5+
// RUN: %swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -lto=llvm-full -c -target x86_64-apple-macosx10.9 | %FileCheck %s
6+
// RUN: %swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -c -lto=llvm-full -target x86_64-apple-macosx10.9 | %FileCheck %s
7+
// RUN: %swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -c -lto=llvm-full -emit-bc -target x86_64-apple-macosx10.9 | %FileCheck %s
8+
// RUN: %swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -emit-bc -c -lto=llvm-full -target x86_64-apple-macosx10.9 | %FileCheck %s
9+
10+
// CHECK: swift
11+
// CHECK-DAG: -emit-bc
12+
// CHECK-DAG: -lto=llvm-full
13+
// CHECK-DAG: -o [[BITCODEFILE:.*\.bc]]

0 commit comments

Comments
 (0)