Coverage Report

Created: 2023-09-30 09:22

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
Line
Count
Source (jump to first uncovered line)
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
12
#include "lldb/Interpreter/Options.h"
13
#include "lldb/Utility/ConstString.h"
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.
21
class OptionGroupPlatform : public OptionGroup {
22
public:
23
  OptionGroupPlatform(bool include_platform_option)
24
12.2k
      : m_include_platform_option(include_platform_option) {}
25
26
12.2k
  ~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
1.06k
  bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
42
43
154
  void SetPlatformName(const char *platform_name) {
44
154
    if (platform_name && 
platform_name[0]138
)
45
60
      m_platform_name.assign(platform_name);
46
94
    else
47
94
      m_platform_name.clear();
48
154
  }
49
50
0
  const std::string &GetSDKRootDirectory() const { return m_sdk_sysroot; }
51
52
0
  void SetSDKRootDirectory(std::string sdk_root_directory) {
53
0
    m_sdk_sysroot = std::move(sdk_root_directory);
54
0
  }
55
56
0
  const std::string &GetSDKBuild() const { return m_sdk_build; }
57
58
0
  void SetSDKBuild(std::string sdk_build) {
59
0
    m_sdk_build = std::move(sdk_build);
60
0
  }
61
62
  bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
63
64
protected:
65
  std::string m_platform_name;
66
  std::string m_sdk_sysroot;
67
  std::string m_sdk_build;
68
  llvm::VersionTuple m_os_version;
69
  bool m_include_platform_option;
70
};
71
72
} // namespace lldb_private
73
74
#endif // LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H