[Clang][AIX][p] Manually Claim -p in front end
authorMichael Francis <michaelfrancis@ibm.com>
Wed, 1 Mar 2023 00:56:06 +0000 (00:56 +0000)
committerMichael Francis <michaelfrancis@ibm.com>
Wed, 15 Mar 2023 23:26:48 +0000 (23:26 +0000)
commitac1d143b0ef924cf2725bb36537f18ae2c7f9c4f
tree953b5a02d16b2f9a9556631afdbb7b24e870b1ce
parent9dbce774eea515e400954f1d0ffbd858c839b546
[Clang][AIX][p] Manually Claim -p in front end

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.

With this patch, if both `-p` and `-pg` are passed, the argument that is
passed second will take precedence. `-p` will still throw an error on
unsupported platforms, regardless of precedence.

This revision includes a test case, which has been placed in
`clang/test/Driver/zos-profiling-error.c`. As a result,
`zos-profiling-error.c` has been renamed to `ibm-profiling.c`. This
revision also passes `clang/test/Driver/aix-ld.c`.

Differential Revision: https://reviews.llvm.org/D145021
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/ibm-profiling.c [new file with mode: 0644]
clang/test/Driver/zos-profiling-error.c [deleted file]