9#ifndef LLVM_CLANG_BASIC_DARWINSDKINFO_H
10#define LLVM_CLANG_BASIC_DARWINSDKINFO_H
13#include "llvm/ADT/DenseMap.h"
14#include "llvm/Support/Error.h"
15#include "llvm/Support/VersionTuple.h"
16#include "llvm/Support/VirtualFileSystem.h"
17#include "llvm/TargetParser/Triple.h"
38 llvm::Triple::EnvironmentType FromEnv,
39 llvm::Triple::OSType ToOS,
40 llvm::Triple::EnvironmentType ToEnv)
50 return OSEnvPair(llvm::Triple::MacOSX, llvm::Triple::UnknownEnvironment,
51 llvm::Triple::IOS, llvm::Triple::MacABI);
57 return OSEnvPair(llvm::Triple::IOS, llvm::Triple::MacABI,
58 llvm::Triple::MacOSX, llvm::Triple::UnknownEnvironment);
64 return OSEnvPair(llvm::Triple::IOS, llvm::Triple::UnknownEnvironment,
65 llvm::Triple::WatchOS, llvm::Triple::UnknownEnvironment);
71 return OSEnvPair(llvm::Triple::IOS, llvm::Triple::UnknownEnvironment,
72 llvm::Triple::TvOS, llvm::Triple::UnknownEnvironment);
89 VersionTuple MinimumKeyVersion, VersionTuple MaximumKeyVersion,
90 VersionTuple MinimumValue, VersionTuple MaximumValue,
91 llvm::DenseMap<VersionTuple, VersionTuple> Mapping)
92 : MinimumKeyVersion(MinimumKeyVersion),
93 MaximumKeyVersion(MaximumKeyVersion), MinimumValue(MinimumValue),
94 MaximumValue(MaximumValue), Mapping(Mapping) {
95 assert(!this->Mapping.empty() &&
"unexpected empty mapping");
104 std::optional<VersionTuple>
105 map(
const VersionTuple &Key,
const VersionTuple &MinimumValue,
106 std::optional<VersionTuple> MaximumValue)
const;
111 std::optional<VersionTuple>
114 if (Key.getMajor() == 100000)
115 return VersionTuple(100000);
117 return map(Key, MinimumValue, std::nullopt);
124 std::optional<VersionTuple>
127 if (Key.getMajor() == 100000)
128 return VersionTuple(100000);
129 return map(Key, MinimumValue, MaximumValue);
132 static std::optional<RelatedTargetVersionMapping>
134 VersionTuple MaximumDeploymentTarget);
137 VersionTuple MinimumKeyVersion;
138 VersionTuple MaximumKeyVersion;
139 VersionTuple MinimumValue;
140 VersionTuple MaximumValue;
141 llvm::DenseMap<VersionTuple, VersionTuple> Mapping;
145 VersionTuple Version, VersionTuple MaximumDeploymentTarget,
147 std::optional<RelatedTargetVersionMapping>>
150 std::optional<RelatedTargetVersionMapping>>())
151 : Version(Version), MaximumDeploymentTarget(MaximumDeploymentTarget),
152 VersionMappings(
std::move(VersionMappings)) {}
154 const llvm::VersionTuple &
getVersion()
const {
return Version; }
168 auto Mapping = VersionMappings.find(
Kind.Value);
169 if (Mapping == VersionMappings.end())
171 return Mapping->getSecond() ? &*Mapping->getSecond() :
nullptr;
174 static std::optional<DarwinSDKInfo>
178 VersionTuple Version;
179 VersionTuple MaximumDeploymentTarget;
184 std::optional<RelatedTargetVersionMapping>>
192Expected<std::optional<DarwinSDKInfo>>
enum clang::sema::@1653::IndirectLocalPathEntry::EntryKind Kind
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
The information about the darwin SDK that was used during this compilation.
const RelatedTargetVersionMapping * getVersionMapping(OSEnvPair Kind) const
DarwinSDKInfo(VersionTuple Version, VersionTuple MaximumDeploymentTarget, llvm::DenseMap< OSEnvPair::StorageType, std::optional< RelatedTargetVersionMapping > > VersionMappings=llvm::DenseMap< OSEnvPair::StorageType, std::optional< RelatedTargetVersionMapping > >())
const llvm::VersionTuple & getVersion() const
static std::optional< DarwinSDKInfo > parseDarwinSDKSettingsJSON(const llvm::json::Object *Obj)
The JSON file list parser is used to communicate input to InstallAPI.
Expected< std::optional< DarwinSDKInfo > > parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS, StringRef SDKRootPath)
Parse the SDK information from the SDKSettings.json file.
Diagnostic wrappers for TextAPI types for error reporting.
A value that describes two os-environment pairs that can be used as a key to the version map in the S...
static constexpr OSEnvPair macCatalystToMacOSPair()
Returns the os-environment mapping pair that's used to represent the Mac Catalyst -> macOS version ma...
static constexpr OSEnvPair macOStoMacCatalystPair()
Returns the os-environment mapping pair that's used to represent the macOS -> Mac Catalyst version ma...
static constexpr OSEnvPair iOStoWatchOSPair()
Returns the os-environment mapping pair that's used to represent the iOS -> watchOS version mapping.
static constexpr OSEnvPair iOStoTvOSPair()
Returns the os-environment mapping pair that's used to represent the iOS -> tvOS version mapping.
constexpr OSEnvPair(llvm::Triple::OSType FromOS, llvm::Triple::EnvironmentType FromEnv, llvm::Triple::OSType ToOS, llvm::Triple::EnvironmentType ToEnv)