LLDB mainline
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 , XRSimulator ,
  XROS , 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.
 XcodeSDK (std::string name, FileSpec sysroot)
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) const
Info Parse () const
 Return parsed SDK type and version number.
bool IsAppleInternalSDK () const
llvm::VersionTuple GetVersion () const
Type GetType () const
llvm::StringRef GetString () const
const FileSpecGetSysroot () const

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
FileSpec m_sysroot

Detailed Description

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

Definition at line 25 of file XcodeSDK.h.

Member Enumeration Documentation

◆ Type

Different types of Xcode SDKs.

Enumerator
MacOSX 
iPhoneSimulator 
iPhoneOS 
AppleTVSimulator 
AppleTVOS 
WatchSimulator 
watchOS 
XRSimulator 
XROS 
bridgeOS 
Linux 
unknown 

Definition at line 31 of file XcodeSDK.h.

Constructor & Destructor Documentation

◆ XcodeSDK() [1/5]

lldb_private::XcodeSDK::XcodeSDK ( )
default

Default constructor, constructs an empty string.

Referenced by GetAnyMacOS(), Merge(), operator=(), operator==(), SDKSupportsModules(), and XcodeSDK().

◆ XcodeSDK() [2/5]

XcodeSDK::XcodeSDK ( XcodeSDK::Info info)

Construct an XcodeSDK object from a specification.

Definition at line 51 of file XcodeSDK.cpp.

References GetName(), and m_name.

◆ XcodeSDK() [3/5]

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 66 of file XcodeSDK.h.

References m_name.

◆ XcodeSDK() [4/5]

lldb_private::XcodeSDK::XcodeSDK ( std::string name,
FileSpec sysroot )
inline

Definition at line 67 of file XcodeSDK.h.

References m_name, and m_sysroot.

◆ XcodeSDK() [5/5]

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

References XcodeSDK().

Member Function Documentation

◆ FindXcodeContentsDirectoryInPath()

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

◆ GetAnyMacOS()

XcodeSDK lldb_private::XcodeSDK::GetAnyMacOS ( )
inlinestatic

◆ GetCanonicalName()

◆ GetSDKTypeForTriple()

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

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

Definition at line 259 of file XcodeSDK.cpp.

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

◆ GetString()

llvm::StringRef XcodeSDK::GetString ( ) const

◆ GetSysroot()

const FileSpec & XcodeSDK::GetSysroot ( ) const

Definition at line 145 of file XcodeSDK.cpp.

References m_sysroot.

Referenced by ResolveSDKPathFromDebugInfo().

◆ GetType()

XcodeSDK::Type XcodeSDK::GetType ( ) const

Definition at line 138 of file XcodeSDK.cpp.

References m_name, and ParseSDKName().

Referenced by SDKSupportsModules().

◆ GetVersion()

llvm::VersionTuple XcodeSDK::GetVersion ( ) const

Definition at line 132 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 157 of file XcodeSDK.cpp.

References l, m_name, m_sysroot, Parse(), and XcodeSDK().

Referenced by lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo(), and ResolveSDKPathFromDebugInfo().

◆ operator=()

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

References XcodeSDK().

◆ operator==()

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

Definition at line 63 of file XcodeSDK.cpp.

References m_name, and XcodeSDK().

◆ Parse()

◆ 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 223 of file XcodeSDK.cpp.

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

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

Member Data Documentation

◆ m_name

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

◆ m_sysroot

FileSpec lldb_private::XcodeSDK::m_sysroot
private

Definition at line 27 of file XcodeSDK.h.

Referenced by GetSysroot(), Merge(), and XcodeSDK().

◆ numSDKTypes

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

Definition at line 45 of file XcodeSDK.h.

Referenced by ParseSDKName().


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