xref: /openbsd-src/gnu/llvm/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
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/Support/VersionTuple.h"
16 #include <optional>
17 
18 namespace lldb_private {
19 
20 class ArchSpec;
21 
22 class HostInfoMacOSX : public HostInfoPosix {
23   friend class HostInfoBase;
24 
25 public:
26   static llvm::VersionTuple GetOSVersion();
27   static llvm::VersionTuple GetMacCatalystVersion();
28   static std::optional<std::string> GetOSBuildString();
29   static FileSpec GetProgramFileSpec();
30   static FileSpec GetXcodeContentsDirectory();
31   static FileSpec GetXcodeDeveloperDirectory();
32 
33   /// Query xcrun to find an Xcode SDK directory.
34   static llvm::Expected<llvm::StringRef> GetXcodeSDKPath(XcodeSDK sdk);
35 
36   /// Shared cache utilities
37   static SharedCacheImageInfo
38   GetSharedCacheImageInfo(llvm::StringRef image_name);
39 
40 protected:
41   static bool ComputeSupportExeDirectory(FileSpec &file_spec);
42   static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
43                                              ArchSpec &arch_64);
44   static bool ComputeHeaderDirectory(FileSpec &file_spec);
45   static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
46   static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
47 };
48 }
49 
50 #endif
51