@@ -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 {
0 commit comments