r193006 - clang-cl: diagnose setting asm listing filename with multiple inputs
Hans Wennborg
hans at hanshq.net
Fri Oct 18 15:49:04 PDT 2013
Author: hans
Date: Fri Oct 18 17:49:04 2013
New Revision: 193006
URL: http://llvm.org/viewvc/llvm-project?rev=193006&view=rev
Log:
clang-cl: diagnose setting asm listing filename with multiple inputs
Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/cl-outputs.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=193006&r1=193005&r2=193006&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Fri Oct 18 17:49:04 2013
@@ -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">;
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=193006&r1=193005&r2=193006&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 18 17:49:04 2013
@@ -1150,12 +1150,23 @@ void Driver::BuildActions(const ToolChai
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') {
Modified: cfe/trunk/test/Driver/cl-outputs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-outputs.c?rev=193006&r1=193005&r2=193006&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-outputs.c (original)
+++ cfe/trunk/test/Driver/cl-outputs.c Fri Oct 18 17:49:04 2013
@@ -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
More information about the cfe-commits
mailing list