LLDB mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
lldb_private::XcodeSDK Class Reference

An abstraction for Xcode-style SDKs that works like ArchSpec. More...

#include <XcodeSDK.h>

Classes

struct  Info
 A parsed SDK directory name. More...
 

Public Types

enum  Type : int {
  MacOSX = 0 , iPhoneSimulator , iPhoneOS , AppleTVSimulator ,
  AppleTVOS , WatchSimulator , watchOS , bridgeOS ,
  Linux , unknown = -1
}
 Different types of Xcode SDKs. More...
 

Public Member Functions

 XcodeSDK ()=default
 Default constructor, constructs an empty string.
 
 XcodeSDK (Info info)
 Construct an XcodeSDK object from a specification.
 
 XcodeSDK (std::string &&name)
 Initialize an XcodeSDK object with an SDK name.
 
void Merge (const XcodeSDK &other)
 The merge function follows a strict order to maintain monotonicity:
 
XcodeSDKoperator= (const XcodeSDK &other)
 
 XcodeSDK (const XcodeSDK &)=default
 
bool operator== (const XcodeSDK &other)
 
Info Parse () const
 Return parsed SDK type and version number.
 
bool IsAppleInternalSDK () const
 
llvm::VersionTuple GetVersion () const
 
Type GetType () const
 
llvm::StringRef GetString () const
 
bool SupportsSwift () const
 Whether this Xcode SDK supports Swift.
 

Static Public Member Functions

static XcodeSDK GetAnyMacOS ()
 
static bool SDKSupportsModules (Type type, llvm::VersionTuple version)
 Whether LLDB feels confident importing Clang modules from this SDK.
 
static bool SDKSupportsModules (Type desired_type, const FileSpec &sdk_path)
 
static std::string GetCanonicalName (Info info)
 Return the canonical SDK name, such as "macosx" for the macOS SDK.
 
static XcodeSDK::Type GetSDKTypeForTriple (const llvm::Triple &triple)
 Return the best-matching SDK type for a specific triple.
 
static std::string FindXcodeContentsDirectoryInPath (llvm::StringRef path)
 

Static Public Attributes

static constexpr int numSDKTypes = Linux + 1
 

Private Attributes

std::string m_name
 

Detailed Description

An abstraction for Xcode-style SDKs that works like ArchSpec.

Definition at line 24 of file XcodeSDK.h.

Member Enumeration Documentation

◆ Type

Different types of Xcode SDKs.

Enumerator
MacOSX 
iPhoneSimulator 
iPhoneOS 
AppleTVSimulator 
AppleTVOS 
WatchSimulator 
watchOS 
bridgeOS 
Linux 
unknown 

Definition at line 29 of file XcodeSDK.h.

Constructor & Destructor Documentation

◆ XcodeSDK() [1/4]

lldb_private::XcodeSDK::XcodeSDK ( )
default

Default constructor, constructs an empty string.

Referenced by GetAnyMacOS().

◆ XcodeSDK() [2/4]

XcodeSDK::XcodeSDK ( XcodeSDK::Info  info)

Construct an XcodeSDK object from a specification.

Definition at line 47 of file XcodeSDK.cpp.

References lldb_private::XcodeSDK::Info::internal, m_name, and lldb_private::XcodeSDK::Info::version.

◆ XcodeSDK() [3/4]

lldb_private::XcodeSDK::XcodeSDK ( std::string &&  name)
inline

Initialize an XcodeSDK object with an SDK name.

The SDK name is the last directory component of a path one would pass to clang's -isysroot parameter. For example, "MacOSX.10.14.sdk".

Definition at line 62 of file XcodeSDK.h.

◆ XcodeSDK() [4/4]

lldb_private::XcodeSDK::XcodeSDK ( const XcodeSDK )
default

Member Function Documentation

◆ FindXcodeContentsDirectoryInPath()

std::string XcodeSDK::FindXcodeContentsDirectoryInPath ( llvm::StringRef  path)
static

◆ GetAnyMacOS()

static XcodeSDK lldb_private::XcodeSDK::GetAnyMacOS ( )
inlinestatic

◆ GetCanonicalName()

std::string XcodeSDK::GetCanonicalName ( XcodeSDK::Info  info)
static

◆ GetSDKTypeForTriple()

XcodeSDK::Type XcodeSDK::GetSDKTypeForTriple ( const llvm::Triple &  triple)
static

Return the best-matching SDK type for a specific triple.

Definition at line 256 of file XcodeSDK.cpp.

References AppleTVOS, AppleTVSimulator, iPhoneOS, iPhoneSimulator, Linux, MacOSX, unknown, watchOS, and WatchSimulator.

◆ GetString()

llvm::StringRef XcodeSDK::GetString ( ) const

◆ GetType()

XcodeSDK::Type XcodeSDK::GetType ( ) const

Definition at line 130 of file XcodeSDK.cpp.

References m_name, and ParseSDKName().

Referenced by SDKSupportsModules().

◆ GetVersion()

llvm::VersionTuple XcodeSDK::GetVersion ( ) const

Definition at line 124 of file XcodeSDK.cpp.

References m_name, ParseSDKName(), and ParseSDKVersion().

Referenced by SDKSupportsModules().

◆ IsAppleInternalSDK()

bool XcodeSDK::IsAppleInternalSDK ( ) const

◆ Merge()

void XcodeSDK::Merge ( const XcodeSDK other)

The merge function follows a strict order to maintain monotonicity:

  1. SDK with the higher SDKType wins.
  2. The newer SDK wins.

Definition at line 147 of file XcodeSDK.cpp.

References l, m_name, and Parse().

Referenced by lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo().

◆ operator=()

XcodeSDK & XcodeSDK::operator= ( const XcodeSDK other)
default

◆ operator==()

bool XcodeSDK::operator== ( const XcodeSDK other)

Definition at line 59 of file XcodeSDK.cpp.

References m_name.

◆ Parse()

XcodeSDK::Info XcodeSDK::Parse ( ) const

◆ SDKSupportsModules() [1/2]

bool XcodeSDK::SDKSupportsModules ( XcodeSDK::Type  desired_type,
const FileSpec sdk_path 
)
static

◆ SDKSupportsModules() [2/2]

bool XcodeSDK::SDKSupportsModules ( XcodeSDK::Type  sdk_type,
llvm::VersionTuple  version 
)
static

Whether LLDB feels confident importing Clang modules from this SDK.

Definition at line 202 of file XcodeSDK.cpp.

References AppleTVOS, AppleTVSimulator, iPhoneOS, iPhoneSimulator, MacOSX, watchOS, and WatchSimulator.

Referenced by lldb_private::PlatformDarwin::DirectoryEnumerator(), lldb_private::PlatformDarwin::GetSDKDirectoryForModules(), and SDKSupportsModules().

◆ SupportsSwift()

bool XcodeSDK::SupportsSwift ( ) const

Member Data Documentation

◆ m_name

std::string lldb_private::XcodeSDK::m_name
private

◆ numSDKTypes

constexpr int lldb_private::XcodeSDK::numSDKTypes = Linux + 1
staticconstexpr

Definition at line 41 of file XcodeSDK.h.

Referenced by ParseSDKName().


The documentation for this class was generated from the following files: