1 //===- llvm/TextAPI/Platform.h - Platform -----------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // Defines the Platforms supported by Tapi and helpers. 10 // 11 //===----------------------------------------------------------------------===// 12 #ifndef LLVM_TEXTAPI_PLATFORM_H 13 #define LLVM_TEXTAPI_PLATFORM_H 14 15 #include "llvm/ADT/SmallSet.h" 16 #include "llvm/BinaryFormat/MachO.h" 17 18 namespace llvm { 19 namespace MachO { 20 21 /// Defines the list of MachO platforms. 22 enum class PlatformKind : unsigned { 23 unknown, 24 macOS = MachO::PLATFORM_MACOS, 25 iOS = MachO::PLATFORM_IOS, 26 tvOS = MachO::PLATFORM_TVOS, 27 watchOS = MachO::PLATFORM_WATCHOS, 28 bridgeOS = MachO::PLATFORM_BRIDGEOS, 29 macCatalyst = MachO::PLATFORM_MACCATALYST, 30 iOSSimulator = MachO::PLATFORM_IOSSIMULATOR, 31 tvOSSimulator = MachO::PLATFORM_TVOSSIMULATOR, 32 watchOSSimulator = MachO::PLATFORM_WATCHOSSIMULATOR, 33 driverKit = MachO::PLATFORM_DRIVERKIT, 34 }; 35 36 using PlatformSet = SmallSet<PlatformKind, 3>; 37 38 PlatformKind mapToPlatformKind(PlatformKind Platform, bool WantSim); 39 PlatformKind mapToPlatformKind(const Triple &Target); 40 PlatformSet mapToPlatformSet(ArrayRef<Triple> Targets); 41 StringRef getPlatformName(PlatformKind Platform); 42 PlatformKind getPlatformFromName(StringRef Name); 43 std::string getOSAndEnvironmentName(PlatformKind Platform, 44 std::string Version = ""); 45 46 } // end namespace MachO. 47 } // end namespace llvm. 48 49 #endif // LLVM_TEXTAPI_PLATFORM_H 50