]> granicus.if.org Git - clang/commitdiff
Driver/IA: Accept and ignore -force_cpusubtype_ALL, as in 'clang -c
authorDaniel Dunbar <daniel@zuster.org>
Mon, 18 Oct 2010 22:36:15 +0000 (22:36 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 18 Oct 2010 22:36:15 +0000 (22:36 +0000)
-Wa,-force_cpusubtype_ALL t.c'.
 - Tweaks -Wa, and -Xassembler handling to only accept an explicit short list of
   arguments and give an obvious unsupported error on others.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116759 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticDriverKinds.td
lib/Driver/Tools.cpp

index 19011ace7f27c35c658f0230c6cc7c7591e96ceb..dd11b700146e0396f06e0b6ac90de1322ee93d8c 100644 (file)
@@ -11,6 +11,8 @@ let Component = "Driver" in {
 
 def err_drv_no_such_file : Error<"no such file or directory: '%0'">;
 def err_drv_unsupported_opt : Error<"unsupported option '%0'">;
+def err_drv_unsupported_option_argument : Error<
+  "unsupported argument '%1' to option '%0'">;
 def err_drv_unknown_stdin_type : Error<
   "-E or -x required when input is from standard input">;
 def err_drv_unknown_language : Error<"language not recognized: '%0'">;
index 99e7e3fe0c95adc0b63379049db4c71b7cfe0bb0..6e221b4c8311fad8508b78bf23a1bfa3ec8bddc3 100644 (file)
@@ -762,10 +762,25 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
                       !IsOpt))
       CmdArgs.push_back("-mrelax-all");
 
-    // When using an integrated assembler, we send -Wa, and -Xassembler options
-    // to -cc1.
-    Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
-                         options::OPT_Xassembler);
+    // When using an integrated assembler, translate -Wa, and -Xassembler
+    // options.
+    for (arg_iterator it = Args.filtered_begin(options::OPT_Wa_COMMA,
+                                               options::OPT_Xassembler),
+           ie = Args.filtered_end(); it != ie; ++it) {
+      const Arg *A = *it;
+      A->claim();
+
+      for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) {
+        llvm::StringRef Value = A->getValue(Args, i);
+
+        if (Value == "-force_cpusubtype_ALL") {
+          // Do nothing, this is the default and we don't support anything else.
+        } else {
+          D.Diag(clang::diag::err_drv_unsupported_option_argument)
+            << A->getOption().getName() << Value;
+        }
+      }
+    }
   } else if (isa<PrecompileJobAction>(JA)) {
     // Use PCH if the user requested it.
     bool UsePCH = D.CCCUsePCH;