Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:50

0001 //===-- OptionGroupPlatform.h -----------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
0010 #define LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
0011 
0012 #include "lldb/Interpreter/Options.h"
0013 #include "lldb/Utility/ConstString.h"
0014 #include "llvm/Support/VersionTuple.h"
0015 
0016 namespace lldb_private {
0017 
0018 // PlatformOptionGroup
0019 //
0020 // Make platform options available to any commands that need the settings.
0021 class OptionGroupPlatform : public OptionGroup {
0022 public:
0023   OptionGroupPlatform(bool include_platform_option)
0024       : m_include_platform_option(include_platform_option) {}
0025 
0026   ~OptionGroupPlatform() override = default;
0027 
0028   llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
0029 
0030   Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
0031                         ExecutionContext *execution_context) override;
0032   Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
0033 
0034   void OptionParsingStarting(ExecutionContext *execution_context) override;
0035 
0036   lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter,
0037                                              const ArchSpec &arch,
0038                                              bool make_selected, Status &error,
0039                                              ArchSpec &platform_arch) const;
0040 
0041   bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
0042 
0043   void SetPlatformName(const char *platform_name) {
0044     if (platform_name && platform_name[0])
0045       m_platform_name.assign(platform_name);
0046     else
0047       m_platform_name.clear();
0048   }
0049 
0050   const std::string &GetSDKRootDirectory() const { return m_sdk_sysroot; }
0051 
0052   void SetSDKRootDirectory(std::string sdk_root_directory) {
0053     m_sdk_sysroot = std::move(sdk_root_directory);
0054   }
0055 
0056   const std::string &GetSDKBuild() const { return m_sdk_build; }
0057 
0058   void SetSDKBuild(std::string sdk_build) {
0059     m_sdk_build = std::move(sdk_build);
0060   }
0061 
0062   bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
0063 
0064 protected:
0065   std::string m_platform_name;
0066   std::string m_sdk_sysroot;
0067   std::string m_sdk_build;
0068   llvm::VersionTuple m_os_version;
0069   bool m_include_platform_option;
0070 };
0071 
0072 } // namespace lldb_private
0073 
0074 #endif // LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H