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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to