From: Hans Wennborg Date: Fri, 18 Oct 2013 22:49:04 +0000 (+0000) Subject: clang-cl: diagnose setting asm listing filename with multiple inputs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b405c954815f2c05a0baac2e2996bf00406ce464;p=clang clang-cl: diagnose setting asm listing filename with multiple inputs git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193006 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index ce6182dd84..ed49006b21 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -33,7 +33,7 @@ def err_drv_use_of_Z_option : Error< "unsupported use of internal gcc -Z option '%0'">; def err_drv_output_argument_with_multiple_files : Error< "cannot specify -o when generating multiple output files">; -def err_drv_obj_file_argument_with_multiple_sources : Error< +def err_drv_out_file_argument_with_multiple_sources : Error< "cannot specify '%0%1' when compiling multiple source files">; def err_no_external_windows_assembler : Error< "there is no external assembler we can use on windows">; diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 101b83c711..4b13933289 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1150,12 +1150,23 @@ void Driver::BuildActions(const ToolChain &TC, DerivedArgList &Args, Args.eraseArg(options::OPT__SLASH_Fo); } else if (Inputs.size() > 1 && !llvm::sys::path::is_separator(V.back())) { // Check whether /Fo tries to name an output file for multiple inputs. - Diag(clang::diag::err_drv_obj_file_argument_with_multiple_sources) + Diag(clang::diag::err_drv_out_file_argument_with_multiple_sources) << A->getSpelling() << V; Args.eraseArg(options::OPT__SLASH_Fo); } } + // Diagnose misuse of /Fa. + if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fa)) { + StringRef V = A->getValue(); + if (Inputs.size() > 1 && !llvm::sys::path::is_separator(V.back())) { + // Check whether /Fa tries to name an asm file for multiple inputs. + Diag(clang::diag::err_drv_out_file_argument_with_multiple_sources) + << A->getSpelling() << V; + Args.eraseArg(options::OPT__SLASH_Fa); + } + } + // Diagnose misuse of /Fe. if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fe)) { if (A->getValue()[0] == '\0') { diff --git a/test/Driver/cl-outputs.c b/test/Driver/cl-outputs.c index 4f586ae7ef..2ceaa85471 100644 --- a/test/Driver/cl-outputs.c +++ b/test/Driver/cl-outputs.c @@ -103,3 +103,5 @@ // FaDIRNAME: "-o" "foo.dir{{[/\\]+}}a.asm" // RUN: %clang_cl /FA /Fafoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FaDIRNAMEEXT %s // FaDIRNAMEEXT: "-o" "foo.dir{{[/\\]+}}a.ext" +// RUN: %clang_cl /Faa.asm -### -- %s %s 2>&1 | FileCheck -check-prefix=FaMULTIPLESOURCE %s +// FaMULTIPLESOURCE: error: cannot specify '/Faa.asm' when compiling multiple source files