Driver/IA: Accept and ignore -force_cpusubtype_ALL, as in 'clang -c
-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
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 99e7e3f..6e221b4 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -762,10 +762,25 @@
!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;