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,
 
  146      llvm::Triple::OSType OS,
 
  148                     std::optional<RelatedTargetVersionMapping>>
 
  151                             std::optional<RelatedTargetVersionMapping>>())
 
  152      : Version(Version), MaximumDeploymentTarget(MaximumDeploymentTarget),
 
  153        OS(OS), VersionMappings(
std::move(VersionMappings)) {}
 
 
  155  const llvm::VersionTuple &
getVersion()
 const { 
return Version; }
 
  157  const llvm::Triple::OSType &
getOS()
 const { 
return OS; }
 
  171    auto Mapping = VersionMappings.find(Kind.Value);
 
  172    if (Mapping == VersionMappings.end())
 
  174    return Mapping->getSecond() ? &*Mapping->getSecond() : 
nullptr;
 
 
  177  static std::optional<DarwinSDKInfo>
 
  181  VersionTuple Version;
 
  182  VersionTuple MaximumDeploymentTarget;
 
  183  llvm::Triple::OSType OS;
 
  188                 std::optional<RelatedTargetVersionMapping>>
 
 
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
const RelatedTargetVersionMapping * getVersionMapping(OSEnvPair Kind) const
const llvm::Triple::OSType & getOS() const
DarwinSDKInfo(VersionTuple Version, VersionTuple MaximumDeploymentTarget, llvm::Triple::OSType OS, 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)
friend class DarwinSDKInfo