Index: llvm/utils/lit/lit/util.py =================================================================== --- llvm/utils/lit/lit/util.py +++ llvm/utils/lit/lit/util.py @@ -385,10 +385,17 @@ return out, err, exitCode +def isMacOSTriple(target_triple): + """Whether the given target triple is for macOS, + e.g. x86_64-apple-darwin, arm64-apple-macos + """ + return 'darwin' in target_triple or 'macos' in target_triple + + def usePlatformSdkOnDarwin(config, lit_config): # On Darwin, support relocatable SDKs by providing Clang with a # default system root path. - if 'darwin' in config.target_triple: + if isMacOSTriple(config.target_triple): try: cmd = subprocess.Popen(['xcrun', '--show-sdk-path', '--sdk', 'macosx'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -404,7 +411,7 @@ def findPlatformSdkVersionOnMacOS(config, lit_config): - if 'darwin' in config.target_triple: + if isMacOSTriple(config.target_triple): try: cmd = subprocess.Popen(['xcrun', '--show-sdk-version', '--sdk', 'macosx'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)