[PATCH] D145021: [Clang][AIX][p] Claim -p in front end

Michael Francis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 28 17:00:35 PST 2023


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()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145021.501338.patch
Type: text/x-patch
Size: 510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230301/8db533c3/attachment.bin>


More information about the cfe-commits mailing list