File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Original file line number Diff line number Diff line change @@ -6097,10 +6097,29 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
6097
6097
}
6098
6098
6099
6099
llvm::PrettyStackTraceString CrashInfo (" Computing output path" );
6100
+
6100
6101
// Output to a user requested destination?
6101
6102
if (AtTopLevel && !isa<DsymutilJobAction>(JA) && !isa<VerifyJobAction>(JA)) {
6102
- if (Arg *FinalOutput = C.getArgs ().getLastArg (options::OPT_o))
6103
+ bool IsCLNonPCH =
6104
+ IsCLMode () && !C.getArgs ().hasArg (options::OPT__SLASH_Yc) &&
6105
+ (isa<PreprocessJobAction>(JA) || isa<PrecompileJobAction>(JA));
6106
+ bool HasAnyOutputArg = C.getArgs ().hasArg (
6107
+ options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON);
6108
+
6109
+ Arg *FinalOutput = nullptr ;
6110
+ if (IsCLNonPCH && HasAnyOutputArg) {
6111
+ FinalOutput = C.getArgs ().getLastArg (
6112
+ options::OPT_o, options::OPT__SLASH_Fo, options::OPT__SLASH_Fo_COLON);
6113
+ } else if (IsCLNonPCH) {
6114
+ FinalOutput = C.getArgs ().getLastArg (options::OPT__SLASH_Fo,
6115
+ options::OPT__SLASH_Fo_COLON);
6116
+ } else {
6117
+ FinalOutput = C.getArgs ().getLastArg (options::OPT_o);
6118
+ }
6119
+
6120
+ if (FinalOutput) {
6103
6121
return C.addResultFile (FinalOutput->getValue (), &JA);
6122
+ }
6104
6123
}
6105
6124
6106
6125
// For /P, preprocess to file named after BaseInput.
You can’t perform that action at this time.
0 commit comments