LLDB  mainline
OptionGroupPlatform.h
Go to the documentation of this file.
1 //===-- OptionGroupPlatform.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_INTERPRETER_OPTIONGROUPPLATFORM_H
10 #define LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
11 
14 #include "llvm/Support/VersionTuple.h"
15 
16 namespace lldb_private {
17 
18 // PlatformOptionGroup
19 //
20 // Make platform options available to any commands that need the settings.
22 public:
23  OptionGroupPlatform(bool include_platform_option)
24  : m_include_platform_option(include_platform_option) {}
25 
26  ~OptionGroupPlatform() override = default;
27 
28  llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
29 
30  Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
31  ExecutionContext *execution_context) override;
32  Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
33 
34  void OptionParsingStarting(ExecutionContext *execution_context) override;
35 
36  lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter,
37  const ArchSpec &arch,
38  bool make_selected, Status &error,
39  ArchSpec &platform_arch) const;
40 
41  bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
42 
43  void SetPlatformName(const char *platform_name) {
44  if (platform_name && platform_name[0])
45  m_platform_name.assign(platform_name);
46  else
47  m_platform_name.clear();
48  }
49 
51 
52  void SetSDKRootDirectory(ConstString sdk_root_directory) {
53  m_sdk_sysroot = sdk_root_directory;
54  }
55 
56  ConstString GetSDKBuild() const { return m_sdk_build; }
57 
58  void SetSDKBuild(ConstString sdk_build) { m_sdk_build = sdk_build; }
59 
60  bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
61 
62 protected:
66  llvm::VersionTuple m_os_version;
68 };
69 
70 } // namespace lldb_private
71 
72 #endif // LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
lldb_private::ExecutionContext
Definition: ExecutionContext.h:291
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::OptionGroup
Definition: Options.h:233
lldb_private::OptionGroupPlatform::CreatePlatformWithOptions
lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, Status &error, ArchSpec &platform_arch) const
Definition: OptionGroupPlatform.cpp:18
lldb_private::OptionGroupPlatform::m_include_platform_option
bool m_include_platform_option
Definition: OptionGroupPlatform.h:67
lldb_private::OptionGroupPlatform::SetSDKRootDirectory
void SetSDKRootDirectory(ConstString sdk_root_directory)
Definition: OptionGroupPlatform.h:52
lldb_private::OptionGroupPlatform
Definition: OptionGroupPlatform.h:21
lldb_private::OptionGroupPlatform::GetSDKRootDirectory
ConstString GetSDKRootDirectory() const
Definition: OptionGroupPlatform.h:50
lldb_private::OptionGroupPlatform::SetPlatformName
void SetPlatformName(const char *platform_name)
Definition: OptionGroupPlatform.h:43
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
Options.h
lldb_private::OptionGroupPlatform::OptionParsingStarting
void OptionParsingStarting(ExecutionContext *execution_context) override
Definition: OptionGroupPlatform.cpp:55
lldb_private::OptionGroupPlatform::SetOptionValue
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
Definition: OptionGroupPlatform.cpp:87
lldb_private::OptionGroupPlatform::GetDefinitions
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Definition: OptionGroupPlatform.cpp:79
lldb_private::OptionGroupPlatform::m_os_version
llvm::VersionTuple m_os_version
Definition: OptionGroupPlatform.h:66
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::OptionGroupPlatform::PlatformMatches
bool PlatformMatches(const lldb::PlatformSP &platform_sp) const
Definition: OptionGroupPlatform.cpp:121
lldb_private::OptionGroupPlatform::OptionGroupPlatform
OptionGroupPlatform(bool include_platform_option)
Definition: OptionGroupPlatform.h:23
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:221
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:38
lldb_private::OptionGroupPlatform::PlatformWasSpecified
bool PlatformWasSpecified() const
Definition: OptionGroupPlatform.h:41
lldb_private::OptionGroupPlatform::GetSDKBuild
ConstString GetSDKBuild() const
Definition: OptionGroupPlatform.h:56
lldb_private::Status
Definition: Status.h:44
lldb_private::OptionGroupPlatform::m_sdk_sysroot
ConstString m_sdk_sysroot
Definition: OptionGroupPlatform.h:64
uint32_t
lldb_private::OptionGroupPlatform::m_sdk_build
ConstString m_sdk_build
Definition: OptionGroupPlatform.h:65
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::OptionGroupPlatform::m_platform_name
std::string m_platform_name
Definition: OptionGroupPlatform.h:63
lldb_private::OptionGroupPlatform::SetSDKBuild
void SetSDKBuild(ConstString sdk_build)
Definition: OptionGroupPlatform.h:58
ConstString.h
lldb_private::OptionGroupPlatform::~OptionGroupPlatform
~OptionGroupPlatform() override=default