[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>
Sun, 12 Mar 2023 07:33:21 +0000 (07:33 +0000)
commit59848b9ebae6a92a4342b1e8aa32feaf5c9c4b51
treea4137b3f48fae6cdc6ed1ad08de3242553bc739e
parent5d6923345320a07b2afc8c69d82c02492f782a2f
[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]