File indexing completed on 2026-05-10 08:42:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_UTILITY_SDK_H
0010 #define LLDB_UTILITY_SDK_H
0011
0012 #include "lldb/lldb-forward.h"
0013 #include "llvm/ADT/StringRef.h"
0014 #include "llvm/Support/VersionTuple.h"
0015 #include <tuple>
0016
0017 namespace llvm {
0018 class Triple;
0019 }
0020
0021 namespace lldb_private {
0022
0023
0024 class XcodeSDK {
0025 std::string m_name;
0026
0027 public:
0028
0029 enum Type : int {
0030 MacOSX = 0,
0031 iPhoneSimulator,
0032 iPhoneOS,
0033 AppleTVSimulator,
0034 AppleTVOS,
0035 WatchSimulator,
0036 watchOS,
0037 XRSimulator,
0038 XROS,
0039 bridgeOS,
0040 Linux,
0041 unknown = -1
0042 };
0043 static constexpr int numSDKTypes = Linux + 1;
0044
0045
0046 struct Info {
0047 Type type = unknown;
0048 llvm::VersionTuple version;
0049 bool internal = false;
0050
0051 Info() = default;
0052 bool operator<(const Info &other) const;
0053 bool operator==(const Info &other) const;
0054 };
0055
0056
0057
0058 XcodeSDK() = default;
0059
0060 XcodeSDK(Info info);
0061
0062
0063
0064 XcodeSDK(std::string &&name) : m_name(std::move(name)) {}
0065 static XcodeSDK GetAnyMacOS() { return XcodeSDK("MacOSX.sdk"); }
0066
0067
0068
0069
0070 void Merge(const XcodeSDK &other);
0071
0072 XcodeSDK &operator=(const XcodeSDK &other);
0073 XcodeSDK(const XcodeSDK&) = default;
0074 bool operator==(const XcodeSDK &other) const;
0075
0076
0077 Info Parse() const;
0078 bool IsAppleInternalSDK() const;
0079 llvm::VersionTuple GetVersion() const;
0080 Type GetType() const;
0081 llvm::StringRef GetString() const;
0082
0083 bool SupportsSwift() const;
0084
0085
0086 static bool SDKSupportsModules(Type type, llvm::VersionTuple version);
0087 static bool SDKSupportsModules(Type desired_type, const FileSpec &sdk_path);
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099 static bool SDKSupportsBuiltinModules(const llvm::Triple &target_triple,
0100 llvm::VersionTuple sdk_version);
0101
0102
0103 static std::string GetCanonicalName(Info info);
0104
0105 static XcodeSDK::Type GetSDKTypeForTriple(const llvm::Triple &triple);
0106
0107 static std::string FindXcodeContentsDirectoryInPath(llvm::StringRef path);
0108 };
0109
0110 }
0111
0112 #endif