[lit] Refactor lit detection of macOS triples to use a centralized query in lit.util.isMacOSTriple.
Currently, lit assumes that a triple is a macOS triple if it contains the string
'darwin' (pattern matching against $ARCH-apple-darwin$NUM). This is incorrect
since the $ARCH-apple-macosx$NUM triples are /also/ valid triples for
macOS. More importantly, turns out Swift is using this triple as well,
preventing a build-script built llvm from passing all of its unit tests on a
Given where we are in the schedule I don't want to touch the triples on either
projects, so instead I am adding this workaround, teaching lit that a triple
with macosx in it should have a 'darwin' supported_feature.
This commit centralizes all the places in LLVM to use the query,
lit.util.isMacOSTriple, instead of checking if 'darwin' is in a triple directly.
In subsequent commits I will:
- Change clang/compiler-rt's lit to use this utility function as well.
- Update isMacOSTriple to recognize other valid triples for macOS such as
triples that replace darwin with macosx (i.e. x86_64-apple-darwin vs