]> granicus.if.org Git - clang/commitdiff
clang-cl: diagnose setting asm listing filename with multiple inputs
authorHans Wennborg <hans@hanshq.net>
Fri, 18 Oct 2013 22:49:04 +0000 (22:49 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 18 Oct 2013 22:49:04 +0000 (22:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193006 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticDriverKinds.td
lib/Driver/Driver.cpp
test/Driver/cl-outputs.c

index ce6182dd84ef932ebebcf224e961dc3d81dfbb42..ed49006b215d44145cbd36ff880e6647bc7c9f79 100644 (file)
@@ -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">;
index 101b83c711fb92270fbae99bcd548d4320d69e59..4b1393328911c5762808ccaf35c6dc4a2b998c61 100644 (file)
@@ -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') {
index 4f586ae7ef2ec23cbf09fad28a0281db7a6e6409..2ceaa85471b18f3f6771cec78bc483c79e6e3147 100644 (file)
 // 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