Skip to content

Commit 59877f1

Browse files
committed
Disable profiling support on Windows
1 parent 633801d commit 59877f1

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ public struct Driver {
361361
Self.validateProfilingArgs(&parsedOptions,
362362
fileSystem: fileSystem,
363363
workingDirectory: workingDirectory,
364-
diagnosticEngine: diagnosticEngine)
364+
diagnosticEngine: diagnosticEngine,
365+
targetTriple: self.frontendTargetInfo.target.triple)
365366
Self.validateCompilationConditionArgs(&parsedOptions, diagnosticEngine: diagnosticEngine)
366367
Self.validateFrameworkSearchPathArgs(&parsedOptions, diagnosticEngine: diagnosticEngine)
367368
Self.validateCoverageArgs(&parsedOptions, diagnosticsEngine: diagnosticEngine)
@@ -1642,12 +1643,32 @@ extension Driver {
16421643
static func validateProfilingArgs(_ parsedOptions: inout ParsedOptions,
16431644
fileSystem: FileSystem,
16441645
workingDirectory: AbsolutePath?,
1645-
diagnosticEngine: DiagnosticsEngine) {
1646+
diagnosticEngine: DiagnosticsEngine,
1647+
targetTriple: Triple) {
16461648
if parsedOptions.hasArgument(.profileGenerate) &&
16471649
parsedOptions.hasArgument(.profileUse) {
16481650
diagnosticEngine.emit(Error.conflictingOptions(.profileGenerate, .profileUse))
16491651
}
16501652

1653+
// Windows executables should be profiled with ETW, whose support needs to be
1654+
// implemented before we can enable the option.
1655+
if targetTriple.isWindows {
1656+
if parsedOptions.hasArgument(.profileGenerate) {
1657+
diagnosticEngine.emit(
1658+
.error_unsupported_opt_for_target(
1659+
arg: "-profile-generate",
1660+
target: targetTriple)
1661+
)
1662+
}
1663+
if parsedOptions.hasArgument(.profileUse) {
1664+
diagnosticEngine.emit(
1665+
.error_unsupported_opt_for_target(
1666+
arg: "-profile-use=",
1667+
target: targetTriple)
1668+
)
1669+
}
1670+
}
1671+
16511672
if let profileArgs = parsedOptions.getLastArgument(.profileUse)?.asMultiple,
16521673
let workingDirectory = workingDirectory ?? fileSystem.currentWorkingDirectory {
16531674
for profilingData in profileArgs {

Sources/SwiftDriver/Jobs/WindowsToolchain+LinkerSupport.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ extension WindowsToolchain {
153153
}
154154

155155
if parsedOptions.hasArgument(.profileGenerate) {
156-
let libProfile = try clangLibraryPath(for: targetTriple, parsedOptions: &parsedOptions)
157-
.appending(components: "clang_rt.profile-\(archName(for: targetTriple)).lib")
158-
commandLine.appendPath(libProfile)
156+
// Profiling support for Windows isn't ready yet. It should have been disabled.
157+
fatalError("Profiling support should have been disabled on Windows.")
159158
}
160159

161160
// Run clang++ in verbose mode if "-v" is set

0 commit comments

Comments
 (0)