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

Michael Francis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 3 11:30:33 PST 2023


francii added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6327
   }
-  if (Arg *A = Args.getLastArgNoClaim(options::OPT_p)) {
+  if (Arg *A = Args.getLastArg(options::OPT_p)) {
     if (TC.getTriple().isOSAIX()) {
----------------
daltenty wrote:
> Actually, a question here. Does this now result in the arg being claimed even if nothing was done it? Since there are case we don't go into the error path.
I've updated the logic of this patch entirely. With these changes, using `-p` and `-pg` together now gives precedence to the option that is passed last.

Now, whenever we check for `-p`, we **never** do a blind claim. We instead manually claim `-p` in the following instances:
1. The user passes `-p` without also passing `-pg`: We manually claim `-p`, and push `-pg` to `CmdArgs`.
2. The user passes both `-p` and `-pg`, but `-p` is given precedence: We manually claim `-p`, and do nothing (since `-pg` is already in `CmdArgs`).

As a result, `-p` will only warn that it goes unused if it is passed before `-pg` (i.e. `clang -p -pg`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145021/new/

https://reviews.llvm.org/D145021



More information about the cfe-commits mailing list