LLDB mainline
|
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. | |
void | Merge (const XcodeSDK &other) |
The merge function follows a strict order to maintain monotonicity: | |
XcodeSDK & | operator= (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 |
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 bool | SDKSupportsBuiltinModules (const llvm::Triple &target_triple, llvm::VersionTuple sdk_version) |
Returns true if the SDK for the specified triple supports builtin modules in system headers. | |
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 |
An abstraction for Xcode-style SDKs that works like ArchSpec.
Definition at line 24 of file XcodeSDK.h.
enum lldb_private::XcodeSDK::Type : int |
Different types of Xcode SDKs.
Enumerator | |
---|---|
MacOSX | |
iPhoneSimulator | |
iPhoneOS | |
AppleTVSimulator | |
AppleTVOS | |
WatchSimulator | |
watchOS | |
XRSimulator | |
XROS | |
bridgeOS | |
Linux | |
unknown |
Definition at line 29 of file XcodeSDK.h.
|
default |
Default constructor, constructs an empty string.
Referenced by GetAnyMacOS().
XcodeSDK::XcodeSDK | ( | XcodeSDK::Info | info | ) |
Construct an XcodeSDK object from a specification.
Definition at line 51 of file XcodeSDK.cpp.
References lldb_private::XcodeSDK::Info::internal, m_name, and lldb_private::XcodeSDK::Info::version.
|
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 64 of file XcodeSDK.h.
|
default |
|
static |
Definition at line 330 of file XcodeSDK.cpp.
Referenced by lldb_private::HostInfoMacOSX::GetXcodeContentsDirectory(), and GetXcodeSDK().
|
inlinestatic |
Definition at line 65 of file XcodeSDK.h.
References XcodeSDK().
Referenced by lldb_private::PlatformMacOSX::GetSDKDirectory(), and lldb_private::HostInfoMacOSX::GetXcodeContentsDirectory().
|
static |
Return the canonical SDK name, such as "macosx" for the macOS SDK.
Definition at line 170 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, WatchSimulator, XROS, and XRSimulator.
Referenced by lldb_private::PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(), lldb_private::HostInfoMacOSX::FindSDKTool(), and GetXcodeSDK().
|
static |
Return the best-matching SDK type for a specific triple.
Definition at line 296 of file XcodeSDK.cpp.
References AppleTVOS, AppleTVSimulator, iPhoneOS, iPhoneSimulator, Linux, MacOSX, unknown, watchOS, WatchSimulator, XROS, and XRSimulator.
llvm::StringRef XcodeSDK::GetString | ( | ) | const |
Definition at line 143 of file XcodeSDK.cpp.
References m_name.
Referenced by lldb_private::HostInfoMacOSX::FindSDKTool(), lldb_private::HostInfoMacOSX::GetSDKRoot(), GetXcodeSDK(), and lldb_private::SymbolFileOnDemand::ParseXcodeSDK().
XcodeSDK::Type XcodeSDK::GetType | ( | ) | const |
Definition at line 138 of file XcodeSDK.cpp.
References m_name, and ParseSDKName().
Referenced by SDKSupportsModules().
llvm::VersionTuple XcodeSDK::GetVersion | ( | ) | const |
Definition at line 132 of file XcodeSDK.cpp.
References m_name, ParseSDKName(), and ParseSDKVersion().
Referenced by SDKSupportsModules().
bool XcodeSDK::IsAppleInternalSDK | ( | ) | const |
Definition at line 125 of file XcodeSDK.cpp.
References m_name, ParseAppleInternalSDK(), ParseSDKName(), and ParseSDKVersion().
Referenced by lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo().
void XcodeSDK::Merge | ( | const XcodeSDK & | other | ) |
The merge function follows a strict order to maintain monotonicity:
Definition at line 155 of file XcodeSDK.cpp.
References l, m_name, and Parse().
Referenced by lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo().
bool XcodeSDK::operator== | ( | const XcodeSDK & | other | ) | const |
Definition at line 63 of file XcodeSDK.cpp.
References m_name.
XcodeSDK::Info XcodeSDK::Parse | ( | ) | const |
Return parsed SDK type and version number.
Definition at line 116 of file XcodeSDK.cpp.
References lldb_private::XcodeSDK::Info::internal, m_name, ParseAppleInternalSDK(), ParseSDKName(), ParseSDKVersion(), lldb_private::XcodeSDK::Info::type, and lldb_private::XcodeSDK::Info::version.
Referenced by lldb_private::HostInfoMacOSX::FindSDKTool(), GetXcodeSDK(), Merge(), and SupportsSwift().
|
static |
Returns true if the SDK for the specified triple supports builtin modules in system headers.
NOTE: should be kept in sync with sdkSupportsBuiltinModules in Toolchains/Darwin.cpp
FIXME: this function will be removed once LLDB's ClangExpressionParser constructs the compiler instance through the driver/toolchain. See SetupImportStdModuleLangOpts
Definition at line 262 of file XcodeSDK.cpp.
Referenced by sdkSupportsBuiltinModules().
|
static |
Definition at line 283 of file XcodeSDK.cpp.
References lldb_private::FileSpec::GetFilename(), lldb_private::ConstString::GetStringRef(), GetType(), GetVersion(), and SDKSupportsModules().
|
static |
Whether LLDB feels confident importing Clang modules from this SDK.
Definition at line 216 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().
bool XcodeSDK::SupportsSwift | ( | ) | const |
Whether this Xcode SDK supports Swift.
Definition at line 239 of file XcodeSDK.cpp.
References AppleTVOS, AppleTVSimulator, iPhoneOS, iPhoneSimulator, Linux, MacOSX, Parse(), lldb_private::XcodeSDK::Info::type, lldb_private::XcodeSDK::Info::version, watchOS, WatchSimulator, XROS, and XRSimulator.
|
private |
Definition at line 25 of file XcodeSDK.h.
Referenced by GetString(), GetType(), GetVersion(), IsAppleInternalSDK(), Merge(), operator==(), Parse(), and XcodeSDK().
|
staticconstexpr |
Definition at line 43 of file XcodeSDK.h.
Referenced by ParseSDKName().