diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 45b41c8bf53e..677e2b635354 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2410,6 +2410,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C, for (const Arg *A : Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler, options::OPT_mimplicit_it_EQ)) { + A->claim(); + if (A->getOption().getID() == options::OPT_mimplicit_it_EQ) { switch (C.getDefaultToolChain().getArch()) { case llvm::Triple::arm: @@ -2427,8 +2429,6 @@ static void CollectArgsForIntegratedAssembler(Compilation &C, } } - A->claim(); - for (StringRef Value : A->getValues()) { if (TakeNextArg) { CmdArgs.push_back(Value.data()); diff --git a/clang/test/Driver/arm-target-as-mimplicit-it.s b/clang/test/Driver/arm-target-as-mimplicit-it.s index eb02aa94e9ad..b4eed3e50632 100644 --- a/clang/test/Driver/arm-target-as-mimplicit-it.s +++ b/clang/test/Driver/arm-target-as-mimplicit-it.s @@ -35,6 +35,8 @@ // RUN: %clang -target arm-linux-gnueabi -### -Wa,-mimplicit-it=always,-mimplicit-it=foo %s 2>&1 | FileCheck %s --check-prefix=INVALID +/// Check that the argument we ignore is still marked as used. +// ALWAYS-NOT: warning: argument unused during compilation: {{.*}}-mimplicit-it={{.*}} /// Check that there isn't a second -arm-implicit-it before or after the one /// that was the indended match. // ALWAYS-NOT: "-arm-implicit-it={{.*}}"