[llvm-rc] Don't rewrite the arch in the default triple unless necessary
authorMartin Storsjö <martin@martin.st>
Fri, 18 Jun 2021 19:59:58 +0000 (22:59 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 25 Jun 2021 19:59:09 +0000 (22:59 +0300)
commitbdb03557c05942d951e1c9b5d7033613323c3104
tree1e0ded0188b0c097c34a9dbc94afcb54335f7cc0
parent2508733e1be28da8c53d36c109007b778225ec7a
[llvm-rc] Don't rewrite the arch in the default triple unless necessary

When the default target arch isn't one that is supported as a
windows target, we want to set a suitable architecture (so that
Clang tests that run plain 'llvm-rc' succeed checks for e.g.
"#ifdef _WIN32" even for llvm builds that default to e.g. ppc64).

But if the default target architecture is usable, don't rewrite it.
(Rewriting it, by e.g. "T.setArch(T.getArch())", normalizes the
spelling of the architecture, e.g. changing i686 to i386. Such a
change can make clang unable to find the right sysroot.)

This can't, unfortunately, practically be tested very well because
it is entirely dependent on the default triple of the llvm build.

Differential Revision: https://reviews.llvm.org/D104589
llvm/tools/llvm-rc/llvm-rc.cpp