From: Daniel Dunbar Date: Mon, 18 Oct 2010 22:36:15 +0000 (+0000) Subject: Driver/IA: Accept and ignore -force_cpusubtype_ALL, as in 'clang -c X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fcec10bded7b9b9268af5232fa17617db0df68ed;p=clang 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/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index 19011ace7f..dd11b70014 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -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'">; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 99e7e3fe0c..6e221b4c83 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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(JA)) { // Use PCH if the user requested it. bool UsePCH = D.CCCUsePCH;