DavidSpickett created this revision. Herald added subscribers: danielkiss, kristof.beyls. DavidSpickett requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Since 4468e5b8999291cc84b78f33f207dcd0e58146bc <https://reviews.llvm.org/rG4468e5b8999291cc84b78f33f207dcd0e58146bc> clang will prefer the last one it finds of "-mimplicit-it" or "-Wa,-mimplicit-it". Due to a mistake in that patch the compiler argument "-mimplicit-it" was never marked as used, even if it was the last one and was passed to llvm. Move the Claim call back to the start of the loop and update the testing to check we don't get any unused argument warnings. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D103086 Files: clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/arm-target-as-mimplicit-it.s Index: clang/test/Driver/arm-target-as-mimplicit-it.s =================================================================== --- clang/test/Driver/arm-target-as-mimplicit-it.s +++ 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={{.*}}" Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -2410,6 +2410,8 @@ 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 @@ } } - A->claim(); - for (StringRef Value : A->getValues()) { if (TakeNextArg) { CmdArgs.push_back(Value.data());
Index: clang/test/Driver/arm-target-as-mimplicit-it.s =================================================================== --- clang/test/Driver/arm-target-as-mimplicit-it.s +++ 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={{.*}}" Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -2410,6 +2410,8 @@ 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 @@ } } - A->claim(); - for (StringRef Value : A->getValues()) { if (TakeNextArg) { CmdArgs.push_back(Value.data());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits