67 lines · c
1//===-- PlatformDarwinDevice.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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMDARWINDEVICE_H10#define LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMDARWINDEVICE_H11 12#include "PlatformDarwin.h"13 14#include "llvm/ADT/StringRef.h"15 16#include <string>17 18namespace lldb_private {19 20/// Abstract Darwin platform with a potential device support directory.21class PlatformDarwinDevice : public PlatformDarwin {22public:23 using PlatformDarwin::PlatformDarwin;24 ~PlatformDarwinDevice() override;25 26protected:27 virtual Status GetSharedModuleWithLocalCache(28 const ModuleSpec &module_spec, lldb::ModuleSP &module_sp,29 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr);30 31 struct SDKDirectoryInfo {32 SDKDirectoryInfo(const FileSpec &sdk_dir_spec);33 FileSpec directory;34 ConstString build;35 llvm::VersionTuple version;36 bool user_cached;37 };38 39 typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection;40 41 bool UpdateSDKDirectoryInfosIfNeeded();42 43 const SDKDirectoryInfo *GetSDKDirectoryForLatestOSVersion();44 const SDKDirectoryInfo *GetSDKDirectoryForCurrentOSVersion();45 46 static FileSystem::EnumerateDirectoryResult47 GetContainedFilesIntoVectorOfStringsCallback(void *baton,48 llvm::sys::fs::file_type ft,49 llvm::StringRef path);50 51 const char *GetDeviceSupportDirectory();52 const char *GetDeviceSupportDirectoryForOSVersion();53 54 virtual llvm::StringRef GetPlatformName() = 0;55 virtual llvm::StringRef GetDeviceSupportDirectoryName() = 0;56 57 std::mutex m_sdk_dir_mutex;58 SDKDirectoryInfoCollection m_sdk_directory_infos;59 60private:61 std::string m_device_support_directory;62 std::string m_device_support_directory_for_os_version;63};64} // namespace lldb_private65 66#endif // LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMDARWINDEVICE_H67