xref: /llvm-project/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h (revision 7de43526e3cc07a02d01a0c4bf0670900495b938)
1 //===-- HostInfoMacOSX.h ----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_HOST_MACOSX_HOSTINFOMACOSX_H
10 #define LLDB_HOST_MACOSX_HOSTINFOMACOSX_H
11 
12 #include "lldb/Host/posix/HostInfoPosix.h"
13 #include "lldb/Utility/FileSpec.h"
14 #include "lldb/Utility/XcodeSDK.h"
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/Support/VersionTuple.h"
17 #include <optional>
18 
19 namespace lldb_private {
20 
21 class ArchSpec;
22 
23 class HostInfoMacOSX : public HostInfoPosix {
24   friend class HostInfoBase;
25 
26 public:
27   static llvm::VersionTuple GetOSVersion();
28   static llvm::VersionTuple GetMacCatalystVersion();
29   static std::optional<std::string> GetOSBuildString();
30   static FileSpec GetProgramFileSpec();
31   static FileSpec GetXcodeContentsDirectory();
32   static FileSpec GetXcodeDeveloperDirectory();
33 
34   /// Query xcrun to find an Xcode SDK directory.
35   static llvm::Expected<llvm::StringRef> GetSDKRoot(SDKOptions options);
36   static llvm::Expected<llvm::StringRef> FindSDKTool(XcodeSDK sdk,
37                                                      llvm::StringRef tool);
38 
39   /// Shared cache utilities
40   static SharedCacheImageInfo
41   GetSharedCacheImageInfo(llvm::StringRef image_name);
42 
43 protected:
44   static bool ComputeSupportExeDirectory(FileSpec &file_spec);
45   static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
46                                              ArchSpec &arch_64);
47   static bool ComputeHeaderDirectory(FileSpec &file_spec);
48   static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
49   static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
50 };
51 }
52 
53 #endif
54