LLVM: lib/TextAPI/Platform.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
17
18namespace llvm {
20
22 switch (Platform) {
23 default:
24 return Platform;
25 case PLATFORM_IOS:
26 return WantSim ? PLATFORM_IOSSIMULATOR : PLATFORM_IOS;
27 case PLATFORM_TVOS:
28 return WantSim ? PLATFORM_TVOSSIMULATOR : PLATFORM_TVOS;
29 case PLATFORM_WATCHOS:
30 return WantSim ? PLATFORM_WATCHOSSIMULATOR : PLATFORM_WATCHOS;
31 }
32}
33
35 switch (Target.getOS()) {
36 default:
37 return PLATFORM_UNKNOWN;
39 return PLATFORM_MACOS;
41 if (Target.isSimulatorEnvironment())
42 return PLATFORM_IOSSIMULATOR;
44 return PLATFORM_MACCATALYST;
45 return PLATFORM_IOS;
47 return Target.isSimulatorEnvironment() ? PLATFORM_TVOSSIMULATOR
48 : PLATFORM_TVOS;
50 return Target.isSimulatorEnvironment() ? PLATFORM_WATCHOSSIMULATOR
51 : PLATFORM_WATCHOS;
53 return PLATFORM_BRIDGEOS;
55 return PLATFORM_DRIVERKIT;
57 return Target.isSimulatorEnvironment() ? PLATFORM_XROS_SIMULATOR
58 : PLATFORM_XROS;
59 }
60}
61
64 for (const auto &Target : Targets)
66 return Result;
67}
68
70 switch (Platform) {
71#define PLATFORM(platform, id, name, build_name, target, tapi_target, \
72 marketing) \
73 case PLATFORM_##platform: \
74 return #marketing;
75#include "llvm/BinaryFormat/MachO.def"
76 }
78}
79
82 .Case("osx", PLATFORM_MACOS)
83#define PLATFORM(platform, id, name, build_name, target, tapi_target, \
84 marketing) \
85 .Case(#target, PLATFORM_##platform)
86#include "llvm/BinaryFormat/MachO.def"
87 .Default(PLATFORM_UNKNOWN);
88}
89
92 switch (Platform) {
93 case PLATFORM_UNKNOWN:
94 return "darwin" + Version;
95 case PLATFORM_MACOS:
97 case PLATFORM_IOS:
99 case PLATFORM_TVOS:
101 case PLATFORM_WATCHOS:
102 return "watchos" + Version;
103 case PLATFORM_BRIDGEOS:
104 return "bridgeos" + Version;
105 case PLATFORM_MACCATALYST:
106 return "ios" + Version + "-macabi";
107 case PLATFORM_IOSSIMULATOR:
108 return "ios" + Version + "-simulator";
109 case PLATFORM_TVOSSIMULATOR:
110 return "tvos" + Version + "-simulator";
111 case PLATFORM_WATCHOSSIMULATOR:
112 return "watchos" + Version + "-simulator";
113 case PLATFORM_DRIVERKIT:
114 return "driverkit" + Version;
115 case PLATFORM_XROS:
117 case PLATFORM_XROS_SIMULATOR:
118 return "xros" + Version + "-simulator";
119 }
121}
122
126 return MinSupportedOS;
130}
131
132}
133}
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Triple - Helper class for working with autoconf configuration names.
LLVM_ABI VersionTuple getOSVersion() const
Parse the version number from the OS name component of the triple, if present.
static LLVM_ABI VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version, bool IsInValidRange)
Returns a canonicalized OS version number for the specified OS.
OSType getOS() const
Get the parsed operating system type of this triple.
LLVM_ABI VersionTuple getMinimumSupportedOSVersion() const
Some platforms have different minimum supported OS versions that varies by the architecture specified...
static LLVM_ABI bool isValidVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns whether an OS version is invalid and would not map to an Apple OS.
Represents a version number in the form major[.minor[.subminor[.build]]].
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI std::string getOSAndEnvironmentName(PlatformType Platform, std::string Version="")
Definition Platform.cpp:90
LLVM_ABI VersionTuple mapToSupportedOSVersion(const Triple &Triple)
Definition Platform.cpp:123
LLVM_ABI PlatformSet mapToPlatformSet(ArrayRef< Triple > Targets)
Definition Platform.cpp:62
SmallSet< PlatformType, 3 > PlatformSet
LLVM_ABI PlatformType mapToPlatformType(PlatformType Platform, bool WantSim)
Definition Platform.cpp:21
LLVM_ABI StringRef getPlatformName(PlatformType Platform)
Definition Platform.cpp:69
LLVM_ABI PlatformType getPlatformFromName(StringRef Name)
Definition Platform.cpp:80
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t Version