File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
clang/lib/Driver/ToolChains Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -205,21 +205,24 @@ void Flang::AddAArch64TargetArgs(const ArgList &Args,
205205
206206void Flang::AddPPCTargetArgs (const ArgList &Args,
207207 ArgStringList &CmdArgs) const {
208+ const Driver &D = getToolChain ().getDriver ();
208209 bool VecExtabi = false ;
209- for (const Arg *A : Args.filtered (options::OPT_mabi_EQ)) {
210+
211+ if (const Arg *A = Args.getLastArg (options::OPT_mabi_EQ)) {
210212 StringRef V = A->getValue ();
211- if (V == " vec-default" ) {
212- VecExtabi = false ;
213- A->claim ();
214- } else if (V == " vec-extabi" ) {
213+ if (V == " vec-extabi" ) {
215214 VecExtabi = true ;
216- A->claim ();
215+ } else if (V == " vec-default" ) {
216+ VecExtabi = false ;
217+ } else {
218+ D.Diag (diag::err_drv_unsupported_option_argument)
219+ << A->getSpelling () << V;
217220 }
218221 }
222+
219223 const llvm::Triple &T = getToolChain ().getTriple ();
220224 if (VecExtabi) {
221225 if (!T.isOSAIX ()) {
222- const Driver &D = getToolChain ().getDriver ();
223226 D.Diag (diag::err_drv_unsupported_opt_for_target)
224227 << " -mabi=vec-extabi" << T.str ();
225228 }
Original file line number Diff line number Diff line change 11! RUN: not %flang -### -c --target=powerpc64le-unknown-linux -mabi=vec-extabi %s 2>&1 | FileCheck --check-prefix=INVALID1 %s
22! RUN: not %flang -### -c --target=x86_64-unknown-linux -mabi=vec-extabi %s 2>&1 | FileCheck --check-prefix=INVALID2 %s
3+ ! RUN: not %flang -### -c --target=powerpc-unknown-aix -mabi=abc %s 2>&1 | FileCheck --check-prefix=INVALID3 %s
34! RUN: %flang -### -c -target powerpc-unknown-aix %s 2>&1 | FileCheck --implicit-check-not=vec-extabi %s
45! RUN: %flang -### -c -target powerpc-unknown-aix -mabi=vec-default %s 2>&1 | FileCheck --implicit-check-not=vec-extabi %s
56! RUN: %flang -### -c -target powerpc-unknown-aix -mabi=vec-extabi %s 2>&1 | FileCheck --check-prefix=EXTABI %s
67
78! INVALID1: error: unsupported option '-mabi=vec-extabi' for target '{{.*}}'
89! INVALID2: error: unsupported option '-mabi=' for target '{{.*}}'
10+ ! INVALID3: error: unsupported argument 'abc' to option '-mabi='
911
1012! EXTABI: "-fc1"
1113! EXTABI-SAME: "-mabi=vec-extabi"
You can’t perform that action at this time.
0 commit comments