[clang][PPC] Checking Unknown Values Passed to -mcpu
authorQiongsi Wu <qiongsiwu@gmail.com>
Tue, 13 Dec 2022 14:40:07 +0000 (09:40 -0500)
committerQiongsi Wu <qiongsiwu@gmail.com>
Tue, 13 Dec 2022 15:18:44 +0000 (10:18 -0500)
commit1fdbe5c573b920f00e5bfdbcea0e837833ae77a0
tree3610f32f2bab8a4e6d6ea493765681d3989273ec
parent1f14056aefe878f3678aff5dd7778017bca836a1
[clang][PPC] Checking Unknown Values Passed to -mcpu

Currently `ppc::getPPCTargetCPU` returns an empty string when it encounters an unknown value passed to `-mcpu`. This causes `clang` to ignore unknown `-mcpu` values silently.

This patch changes the behaviour of `ppc::getPPCTargetCPU` so that it passes the unknown option to the target info, so the target info can actually check if the CPU string is supported, and report an error when encountering unknown/unsupported CPU string.

Reviewed By: jamieschmeiser

Differential Revision: https://reviews.llvm.org/D139720
clang/lib/Driver/ToolChains/Arch/PPC.cpp
clang/lib/Driver/ToolChains/Arch/PPC.h
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/ppc-cpus.c