francii created this revision. Herald added a project: All. francii requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added a project: clang.
The current implementation of `-p` does not claim the argument once it is passed. Since it pushes `-pg` directly, it is only ever referred to again when linking. As a result, when compiling with `-S`, the compiler warns that `-p` goes unused even though that is not the case. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D145021 Files: clang/lib/Driver/ToolChains/Clang.cpp Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -6324,7 +6324,7 @@ << A->getAsString(Args) << TripleStr; } } - if (Arg *A = Args.getLastArgNoClaim(options::OPT_p)) { + if (Arg *A = Args.getLastArg(options::OPT_p)) { if (TC.getTriple().isOSAIX()) { CmdArgs.push_back("-pg"); } else if (!TC.getTriple().isOSOpenBSD()) {
Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -6324,7 +6324,7 @@ << A->getAsString(Args) << TripleStr; } } - if (Arg *A = Args.getLastArgNoClaim(options::OPT_p)) { + if (Arg *A = Args.getLastArg(options::OPT_p)) { if (TC.getTriple().isOSAIX()) { CmdArgs.push_back("-pg"); } else if (!TC.getTriple().isOSOpenBSD()) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits