Previously, when clang reports an error when -fno-split-machine-functions is used for non-X86 archs.
However, in some cases, users may specify flags as "-fsplit-machine-functions -fother-flags -fno-split-machine-functions", the first one is from a global flag set, the last one is used to negate the global flag, we think this is a valid usage mode.
Another cases is when clang is used to invoke multiple workloads, like "-x cuda -fsplit-machine-functions -Xarch_device -fno-split-machine-functions", the latter is used to negate the global -fsplit-machine-functions when invoke workloads for GPU."
This change makes this work, so all below are valid usages and does not have any warnings:
- ./bin/clang -x cuda -nocudalib -nocudainc -Xarch_host -fsplit-machine-functions -S ~/test.c
- ./bin/clang -x cuda -nocudalib -nocudainc -fsplit-machine-functions -Xarch_device -fnosplit-machine-functions -S ~/test.c
- ./bin/clang -x cuda -nocudalib -nocudainc -Xarch_host -fsplit-machine-functions -Xarch_device -fnosplit-machine-functions -S ~/test.c
We should not test clang: before error:. It may be a different string in certain builds where %clang is a symlink to a file not named clang. This would also fail on Windows. Rule of thumb: don't test the exact string before error: