@@ -4226,6 +4226,39 @@ void Driver::handleArguments(Compilation &C, DerivedArgList &Args,
4226
4226
const InputList &Inputs,
4227
4227
ActionList &Actions) const {
4228
4228
4229
+ // Diagnose misuse of /Fo.
4230
+ if (Arg *A = Args.getLastArg (options::OPT__SLASH_Fo)) {
4231
+ StringRef V = A->getValue ();
4232
+ if (Inputs.size () > 1 && !V.empty () &&
4233
+ !llvm::sys::path::is_separator (V.back ())) {
4234
+ // Check whether /Fo tries to name an output file for multiple inputs.
4235
+ Diag (clang::diag::err_drv_out_file_argument_with_multiple_sources)
4236
+ << A->getSpelling () << V;
4237
+ Args.eraseArg (options::OPT__SLASH_Fo);
4238
+ }
4239
+ }
4240
+
4241
+ // Diagnose misuse of /Fa.
4242
+ if (Arg *A = Args.getLastArg (options::OPT__SLASH_Fa)) {
4243
+ StringRef V = A->getValue ();
4244
+ if (Inputs.size () > 1 && !V.empty () &&
4245
+ !llvm::sys::path::is_separator (V.back ())) {
4246
+ // Check whether /Fa tries to name an asm file for multiple inputs.
4247
+ Diag (clang::diag::err_drv_out_file_argument_with_multiple_sources)
4248
+ << A->getSpelling () << V;
4249
+ Args.eraseArg (options::OPT__SLASH_Fa);
4250
+ }
4251
+ }
4252
+
4253
+ // Diagnose misuse of /o.
4254
+ if (Arg *A = Args.getLastArg (options::OPT__SLASH_o)) {
4255
+ if (A->getValue ()[0 ] == ' \0 ' ) {
4256
+ // It has to have a value.
4257
+ Diag (clang::diag::err_drv_missing_argument) << A->getSpelling () << 1 ;
4258
+ Args.eraseArg (options::OPT__SLASH_o);
4259
+ }
4260
+ }
4261
+
4229
4262
// Ignore /Yc/Yu if both /Yc and /Yu passed but with different filenames.
4230
4263
Arg *YcArg = Args.getLastArg (options::OPT__SLASH_Yc);
4231
4264
Arg *YuArg = Args.getLastArg (options::OPT__SLASH_Yu);
@@ -4368,39 +4401,6 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
4368
4401
return ;
4369
4402
}
4370
4403
4371
- // Diagnose misuse of /Fo.
4372
- if (Arg *A = Args.getLastArg (options::OPT__SLASH_Fo)) {
4373
- StringRef V = A->getValue ();
4374
- if (Inputs.size () > 1 && !V.empty () &&
4375
- !llvm::sys::path::is_separator (V.back ())) {
4376
- // Check whether /Fo tries to name an output file for multiple inputs.
4377
- Diag (clang::diag::err_drv_out_file_argument_with_multiple_sources)
4378
- << A->getSpelling () << V;
4379
- Args.eraseArg (options::OPT__SLASH_Fo);
4380
- }
4381
- }
4382
-
4383
- // Diagnose misuse of /Fa.
4384
- if (Arg *A = Args.getLastArg (options::OPT__SLASH_Fa)) {
4385
- StringRef V = A->getValue ();
4386
- if (Inputs.size () > 1 && !V.empty () &&
4387
- !llvm::sys::path::is_separator (V.back ())) {
4388
- // Check whether /Fa tries to name an asm file for multiple inputs.
4389
- Diag (clang::diag::err_drv_out_file_argument_with_multiple_sources)
4390
- << A->getSpelling () << V;
4391
- Args.eraseArg (options::OPT__SLASH_Fa);
4392
- }
4393
- }
4394
-
4395
- // Diagnose misuse of /o.
4396
- if (Arg *A = Args.getLastArg (options::OPT__SLASH_o)) {
4397
- if (A->getValue ()[0 ] == ' \0 ' ) {
4398
- // It has to have a value.
4399
- Diag (clang::diag::err_drv_missing_argument) << A->getSpelling () << 1 ;
4400
- Args.eraseArg (options::OPT__SLASH_o);
4401
- }
4402
- }
4403
-
4404
4404
handleArguments (C, Args, Inputs, Actions);
4405
4405
4406
4406
bool UseNewOffloadingDriver =
0 commit comments