diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -634,8 +634,9 @@ // If target is MIPS adjust the target triple // accordingly to provided ABI name. - A = Args.getLastArg(options::OPT_mabi_EQ); + A = Args.getLastArgNoClaim(options::OPT_mabi_EQ); if (A && Target.isMIPS()) { + A->claim(); StringRef ABIName = A->getValue(); if (ABIName == "32") { Target = Target.get32BitArchVariant(); diff --git a/clang/test/Driver/mabi.c b/clang/test/Driver/mabi.c new file mode 100644 --- /dev/null +++ b/clang/test/Driver/mabi.c @@ -0,0 +1,6 @@ +// RUN: %clang -target i386-unknown-linux -mabi=ms -S %s -### 2>&1 | FileCheck --check-prefix=CHECK %s + +int f() { + // CHECK: warning: argument unused during compilation: '-mabi=ms' + return 0; +}