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>

Collaboration diagram for lldb_private::XcodeSDK:
Collaboration graph
[legend]

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

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. More...
 
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. More...
 
static XcodeSDK::Type GetSDKTypeForTriple (const llvm::Triple &triple)
 Return the best-matching SDK type for a specific triple. More...
 
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.

◆ 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

Return the canonical SDK name, such as "macosx" for the macOS SDK.

Definition at line 165 of file XcodeSDK.cpp.

References AppleTVOS, AppleTVSimulator, bridgeOS, lldb_private::XcodeSDK::Info::internal, iPhoneOS, iPhoneSimulator, Linux, MacOSX, lldb_private::XcodeSDK::Info::type, unknown, lldb_private::XcodeSDK::Info::version, watchOS, and WatchSimulator.

Referenced by GetXcodeSDK().

◆ 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, and WatchSimulator.

◆ GetString()

llvm::StringRef XcodeSDK::GetString ( ) const

Definition at line 138 of file XcodeSDK.cpp.

References m_name.

Referenced by lldb_private::HostInfoMacOSX::GetXcodeSDKPath().

◆ GetType()

XcodeSDK::Type XcodeSDK::GetType ( ) const

Definition at line 133 of file XcodeSDK.cpp.

References m_name, and ParseSDKName().

◆ GetVersion()

llvm::VersionTuple XcodeSDK::GetVersion ( ) const

Definition at line 127 of file XcodeSDK.cpp.

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

◆ IsAppleInternalSDK()

bool XcodeSDK::IsAppleInternalSDK ( ) const

Definition at line 120 of file XcodeSDK.cpp.

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

◆ Merge()

void XcodeSDK::Merge ( 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 150 of file XcodeSDK.cpp.

References m_name, and Parse().

◆ operator=()

XcodeSDK & XcodeSDK::operator= ( XcodeSDK  other)

Definition at line 57 of file XcodeSDK.cpp.

References m_name.

◆ operator==()

bool XcodeSDK::operator== ( XcodeSDK  other)

Definition at line 62 of file XcodeSDK.cpp.

References m_name.

◆ Parse()

XcodeSDK::Info XcodeSDK::Parse ( ) const

◆ SDKSupportsModules() [1/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 205 of file XcodeSDK.cpp.

Referenced by SDKSupportsModules().

◆ SDKSupportsModules() [2/2]

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

◆ SupportsSwift()

bool XcodeSDK::SupportsSwift ( ) const

Whether this Xcode SDK supports Swift.

Definition at line 225 of file XcodeSDK.cpp.

References Parse(), lldb_private::XcodeSDK::Info::type, and lldb_private::XcodeSDK::Info::version.

Member Data Documentation

◆ m_name

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

◆ numSDKTypes

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

Definition at line 41 of file XcodeSDK.h.

Referenced by ParseSDKName().


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