[llvm-rc] Try to fix the Preprocessor/llvm-rc.rc test on non arm/x86 architectures
authorMartin Storsjö <martin@martin.st>
Wed, 21 Apr 2021 09:40:39 +0000 (12:40 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 21 Apr 2021 09:47:33 +0000 (12:47 +0300)
commit066b8f2fc6d584635a017a0a15494ce4460744e3
treefd1ba8d3c02e63b5c045c6ced7b1f7f6724c8037
parentdc256a443a456a8e0e4d72736fee1c9442bcf4bd
[llvm-rc] Try to fix the Preprocessor/llvm-rc.rc test on non arm/x86 architectures

When llvm-rc invokes clang for preprocessing, it uses a target
triple derived from the default target. The test verifies that
e.g. _WIN32 is defined when preprocessing.

If running clang with e.g. -target ppc64le-windows-msvc, that
particular arch/OS combination isn't hooked up, so _WIN32 doesn't
get defined in that configuration. Therefore, the preprocessing
test fails.

Instead make llvm-rc inspect the architecture of the default target.
If it's one of the known supported architectures, use it as such,
otherwise set a default one (x86_64). (Clang can run preprocessing
with an x86_64 target triple, even if the x86 backend isn't
enabled.)

Also remove superfluous llvm:: specifications on enums in llvm-rc.cpp.
clang/test/Preprocessor/llvm-rc.rc
llvm/tools/llvm-rc/llvm-rc.cpp