Coverage Report

Created: 2023-09-30 09:22

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Interpreter/OptionValue.h
Line
Count
Source (jump to first uncovered line)
1
//===-- OptionValue.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_OPTIONVALUE_H
10
#define LLDB_INTERPRETER_OPTIONVALUE_H
11
12
#include "lldb/Core/FormatEntity.h"
13
#include "lldb/Utility/ArchSpec.h"
14
#include "lldb/Utility/Cloneable.h"
15
#include "lldb/Utility/CompletionRequest.h"
16
#include "lldb/Utility/ConstString.h"
17
#include "lldb/Utility/FileSpec.h"
18
#include "lldb/Utility/FileSpecList.h"
19
#include "lldb/Utility/Status.h"
20
#include "lldb/Utility/StringList.h"
21
#include "lldb/Utility/UUID.h"
22
#include "lldb/lldb-defines.h"
23
#include "lldb/lldb-private-enumerations.h"
24
#include "lldb/lldb-private-interfaces.h"
25
#include "llvm/Support/JSON.h"
26
#include <mutex>
27
28
namespace lldb_private {
29
30
// OptionValue
31
class OptionValue {
32
public:
33
  enum Type {
34
    eTypeInvalid = 0,
35
    eTypeArch,
36
    eTypeArgs,
37
    eTypeArray,
38
    eTypeBoolean,
39
    eTypeChar,
40
    eTypeDictionary,
41
    eTypeEnum,
42
    eTypeFileLineColumn,
43
    eTypeFileSpec,
44
    eTypeFileSpecList,
45
    eTypeFormat,
46
    eTypeLanguage,
47
    eTypePathMap,
48
    eTypeProperties,
49
    eTypeRegex,
50
    eTypeSInt64,
51
    eTypeString,
52
    eTypeUInt64,
53
    eTypeUUID,
54
    eTypeFormatEntity
55
  };
56
57
  enum {
58
    eDumpOptionName = (1u << 0),
59
    eDumpOptionType = (1u << 1),
60
    eDumpOptionValue = (1u << 2),
61
    eDumpOptionDescription = (1u << 3),
62
    eDumpOptionRaw = (1u << 4),
63
    eDumpOptionCommand = (1u << 5),
64
    eDumpGroupValue = (eDumpOptionName | eDumpOptionType | eDumpOptionValue),
65
    eDumpGroupHelp =
66
        (eDumpOptionName | eDumpOptionType | eDumpOptionDescription),
67
    eDumpGroupExport = (eDumpOptionCommand | eDumpOptionName | eDumpOptionValue)
68
  };
69
70
1.64M
  OptionValue() = default;
71
72
1.78M
  virtual ~OptionValue() = default;
73
74
  OptionValue(const OptionValue &other);
75
  
76
  OptionValue& operator=(const OptionValue &other);
77
78
  // Subclasses should override these functions
79
  virtual Type GetType() const = 0;
80
81
  // If this value is always hidden, the avoid showing any info on this value,
82
  // just show the info for the child values.
83
2.98k
  virtual bool ValueIsTransparent() const {
84
2.98k
    return GetType() == eTypeProperties;
85
2.98k
  }
86
87
597
  virtual const char *GetTypeAsCString() const {
88
597
    return GetBuiltinTypeAsCString(GetType());
89
597
  }
90
91
  static const char *GetBuiltinTypeAsCString(Type t);
92
93
  virtual void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
94
                         uint32_t dump_mask) = 0;
95
96
  // TODO: make this function pure virtual after implementing it in all
97
  // child classes.
98
24
  virtual llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) {
99
    // Return nullptr which will create a llvm::json::Value() that is a NULL
100
    // value. No setting should ever really have a NULL value in JSON. This
101
    // indicates an error occurred and if/when we add a FromJSON() it will know
102
    // to fail if someone tries to set it with a NULL JSON value.
103
24
    return nullptr;
104
24
  }
105
106
  virtual Status
107
  SetValueFromString(llvm::StringRef value,
108
                     VarSetOperationType op = eVarSetOperationAssign);
109
110
  virtual void Clear() = 0;
111
112
  virtual lldb::OptionValueSP
113
  DeepCopy(const lldb::OptionValueSP &new_parent) const;
114
115
  virtual void AutoComplete(CommandInterpreter &interpreter,
116
                            CompletionRequest &request);
117
118
  // Subclasses can override these functions
119
  virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
120
                                          llvm::StringRef name,
121
0
                                          Status &error) const {
122
0
    error.SetErrorStringWithFormatv("'{0}' is not a valid subvalue", name);
123
0
    return lldb::OptionValueSP();
124
0
  }
125
126
  virtual Status SetSubValue(const ExecutionContext *exe_ctx,
127
                             VarSetOperationType op, llvm::StringRef name,
128
                             llvm::StringRef value);
129
130
0
  virtual bool IsAggregateValue() const { return false; }
131
132
1.30k
  virtual llvm::StringRef GetName() const { return llvm::StringRef(); }
133
134
  virtual bool DumpQualifiedName(Stream &strm) const;
135
136
  // Subclasses should NOT override these functions as they use the above
137
  // functions to implement functionality
138
17.2k
  uint32_t GetTypeAsMask() { return 1u << GetType(); }
139
140
41.2k
  static uint32_t ConvertTypeToMask(OptionValue::Type type) {
141
41.2k
    return 1u << type;
142
41.2k
  }
143
144
90
  static OptionValue::Type ConvertTypeMaskToType(uint32_t type_mask) {
145
    // If only one bit is set, then return an appropriate enumeration
146
90
    switch (type_mask) {
147
0
    case 1u << eTypeArch:
148
0
      return eTypeArch;
149
0
    case 1u << eTypeArgs:
150
0
      return eTypeArgs;
151
0
    case 1u << eTypeArray:
152
0
      return eTypeArray;
153
0
    case 1u << eTypeBoolean:
154
0
      return eTypeBoolean;
155
0
    case 1u << eTypeChar:
156
0
      return eTypeChar;
157
0
    case 1u << eTypeDictionary:
158
0
      return eTypeDictionary;
159
6
    case 1u << eTypeEnum:
160
6
      return eTypeEnum;
161
0
    case 1u << eTypeFileLineColumn:
162
0
      return eTypeFileLineColumn;
163
0
    case 1u << eTypeFileSpec:
164
0
      return eTypeFileSpec;
165
0
    case 1u << eTypeFileSpecList:
166
0
      return eTypeFileSpecList;
167
0
    case 1u << eTypeFormat:
168
0
      return eTypeFormat;
169
0
    case 1u << eTypeLanguage:
170
0
      return eTypeLanguage;
171
0
    case 1u << eTypePathMap:
172
0
      return eTypePathMap;
173
0
    case 1u << eTypeProperties:
174
0
      return eTypeProperties;
175
0
    case 1u << eTypeRegex:
176
0
      return eTypeRegex;
177
0
    case 1u << eTypeSInt64:
178
0
      return eTypeSInt64;
179
84
    case 1u << eTypeString:
180
84
      return eTypeString;
181
0
    case 1u << eTypeUInt64:
182
0
      return eTypeUInt64;
183
0
    case 1u << eTypeUUID:
184
0
      return eTypeUUID;
185
90
    }
186
    // Else return invalid
187
0
    return eTypeInvalid;
188
90
  }
189
190
  static lldb::OptionValueSP
191
  CreateValueFromCStringForTypeMask(const char *value_cstr, uint32_t type_mask,
192
                                    Status &error);
193
194
  OptionValueArch *GetAsArch();
195
  const OptionValueArch *GetAsArch() const;
196
197
  OptionValueArray *GetAsArray();
198
  const OptionValueArray *GetAsArray() const;
199
200
  OptionValueArgs *GetAsArgs();
201
  const OptionValueArgs *GetAsArgs() const;
202
203
  OptionValueBoolean *GetAsBoolean();
204
  const OptionValueBoolean *GetAsBoolean() const;
205
206
  OptionValueChar *GetAsChar();
207
  const OptionValueChar *GetAsChar() const;
208
209
  OptionValueDictionary *GetAsDictionary();
210
  const OptionValueDictionary *GetAsDictionary() const;
211
212
  OptionValueEnumeration *GetAsEnumeration();
213
  const OptionValueEnumeration *GetAsEnumeration() const;
214
215
  OptionValueFileSpec *GetAsFileSpec();
216
  const OptionValueFileSpec *GetAsFileSpec() const;
217
218
  OptionValueFileSpecList *GetAsFileSpecList();
219
  const OptionValueFileSpecList *GetAsFileSpecList() const;
220
221
  OptionValueFormat *GetAsFormat();
222
  const OptionValueFormat *GetAsFormat() const;
223
224
  OptionValueLanguage *GetAsLanguage();
225
  const OptionValueLanguage *GetAsLanguage() const;
226
227
  OptionValuePathMappings *GetAsPathMappings();
228
  const OptionValuePathMappings *GetAsPathMappings() const;
229
230
  OptionValueProperties *GetAsProperties();
231
  const OptionValueProperties *GetAsProperties() const;
232
233
  OptionValueRegex *GetAsRegex();
234
  const OptionValueRegex *GetAsRegex() const;
235
236
  OptionValueSInt64 *GetAsSInt64();
237
  const OptionValueSInt64 *GetAsSInt64() const;
238
239
  OptionValueString *GetAsString();
240
  const OptionValueString *GetAsString() const;
241
242
  OptionValueUInt64 *GetAsUInt64();
243
  const OptionValueUInt64 *GetAsUInt64() const;
244
245
  OptionValueUUID *GetAsUUID();
246
  const OptionValueUUID *GetAsUUID() const;
247
248
  OptionValueFormatEntity *GetAsFormatEntity();
249
  const OptionValueFormatEntity *GetAsFormatEntity() const;
250
251
  bool AppendFileSpecValue(FileSpec file_spec);
252
253
15.7k
  bool OptionWasSet() const { return m_value_was_set; }
254
255
177
  void SetOptionWasSet() { m_value_was_set = true; }
256
257
1.48M
  void SetParent(const lldb::OptionValueSP &parent_sp) {
258
1.48M
    m_parent_wp = parent_sp;
259
1.48M
  }
260
261
14.4k
  lldb::OptionValueSP GetParent() const { return m_parent_wp.lock(); }
262
263
126k
  void SetValueChangedCallback(std::function<void()> callback) {
264
126k
    m_callback = std::move(callback);
265
126k
  }
266
267
43.9k
  void NotifyValueChanged() {
268
43.9k
    if (m_callback)
269
162
      m_callback();
270
43.9k
  }
271
272
  template <typename T, std::enable_if_t<!std::is_pointer_v<T>, bool> = true>
273
10.3M
  std::optional<T> GetValueAs() const {
274
10.3M
    if constexpr (std::is_same_v<T, uint64_t>)
275
759k
      
return0
GetUInt64Value();
276
9.62M
    
if constexpr (0
std::is_same_v<T, int64_t>)
277
9.73k
      
return0
GetSInt64Value();
278
9.61M
    
if constexpr (0
std::is_same_v<T, bool>)
279
7.32M
      
return0
GetBooleanValue();
280
2.28M
    
if constexpr (0
std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
2.28M
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
2.28M
    if constexpr (std::is_same_v<T, FileSpec>)
285
58.5k
      
return0
GetFileSpecValue();
286
2.22M
    
if constexpr (0
std::is_same_v<T, FileSpecList>)
287
346k
      
return0
GetFileSpecListValue();
288
1.88M
    
if constexpr (0
std::is_same_v<T, lldb::LanguageType>)
289
11.4k
      
return0
GetLanguageValue();
290
1.87M
    
if constexpr (0
std::is_same_v<T, llvm::StringRef>)
291
32.5k
      
return0
GetStringValue();
292
1.83M
    
if constexpr (0
std::is_same_v<T, ArchSpec>)
293
6.29k
      
return0
GetArchSpecValue();
294
1.83M
    
if constexpr (0
std::is_enum_v<T>)
295
1.83M
      
if0
(std::optional<int64_t> value = GetEnumerationValue())
296
1.83M
        return static_cast<T>(*value);
297
18.4E
    return {};
298
0
  }
_ZNK12lldb_private11OptionValue10GetValueAsIN4lldb14ScriptLanguageETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
509k
  std::optional<T> GetValueAs() const {
274
509k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
509k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
509k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
509k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
509k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
509k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
509k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
509k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
509k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
509k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
509k
    if constexpr (std::is_enum_v<T>)
295
509k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
509k
        return static_cast<T>(*value);
297
18.4E
    return {};
298
509k
  }
_ZNK12lldb_private11OptionValue10GetValueAsIN4lldb14StopShowColumnETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
1.49k
  std::optional<T> GetValueAs() const {
274
1.49k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
1.49k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
1.49k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
1.49k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
1.49k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
1.49k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
1.49k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
1.49k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
1.49k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
1.49k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
1.49k
    if constexpr (std::is_enum_v<T>)
295
1.49k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
1.49k
        return static_cast<T>(*value);
297
0
    return {};
298
1.49k
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_8Debugger19StopDisassemblyTypeETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
1.58k
  std::optional<T> GetValueAs() const {
274
1.58k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
1.58k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
1.58k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
1.58k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
1.58k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
1.58k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
1.58k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
1.58k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
1.58k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
1.58k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
1.58k
    if constexpr (std::is_enum_v<T>)
295
1.58k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
1.58k
        return static_cast<T>(*value);
297
0
    return {};
298
1.58k
  }
_ZNK12lldb_private11OptionValue10GetValueAsIN4lldb18DWIMPrintVerbosityETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
74
  std::optional<T> GetValueAs() const {
274
74
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
74
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
74
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
74
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
74
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
74
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
74
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
74
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
74
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
74
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
74
    if constexpr (std::is_enum_v<T>)
295
74
      if (std::optional<int64_t> value = GetEnumerationValue())
296
74
        return static_cast<T>(*value);
297
0
    return {};
298
74
  }
_ZNK12lldb_private11OptionValue10GetValueAsIbTnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS2_8optionalIS4_EEv
Line
Count
Source
273
7.32M
  std::optional<T> GetValueAs() const {
274
7.32M
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
7.32M
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
7.32M
    if constexpr (std::is_same_v<T, bool>)
279
7.32M
      return GetBooleanValue();
280
0
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
0
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
0
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
0
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
0
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
0
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
0
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
0
    if constexpr (std::is_enum_v<T>)
295
0
      if (std::optional<int64_t> value = GetEnumerationValue())
296
0
        return static_cast<T>(*value);
297
0
    return {};
298
7.32M
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_8FileSpecETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
58.5k
  std::optional<T> GetValueAs() const {
274
58.5k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
58.5k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
58.5k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
58.5k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
58.5k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
58.5k
    if constexpr (std::is_same_v<T, FileSpec>)
285
58.5k
      return GetFileSpecValue();
286
0
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
0
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
0
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
0
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
0
    if constexpr (std::is_enum_v<T>)
295
0
      if (std::optional<int64_t> value = GetEnumerationValue())
296
0
        return static_cast<T>(*value);
297
0
    return {};
298
58.5k
  }
_ZNK12lldb_private11OptionValue10GetValueAsIyTnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS2_8optionalIS4_EEv
Line
Count
Source
273
759k
  std::optional<T> GetValueAs() const {
274
759k
    if constexpr (std::is_same_v<T, uint64_t>)
275
759k
      return GetUInt64Value();
276
0
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
0
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
0
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
0
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
0
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
0
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
0
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
0
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
0
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
0
    if constexpr (std::is_enum_v<T>)
295
0
      if (std::optional<int64_t> value = GetEnumerationValue())
296
0
        return static_cast<T>(*value);
297
0
    return {};
298
759k
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_12FileSpecListETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
346k
  std::optional<T> GetValueAs() const {
274
346k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
346k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
346k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
346k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
346k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
346k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
346k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
346k
      return GetFileSpecListValue();
288
0
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
0
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
0
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
0
    if constexpr (std::is_enum_v<T>)
295
0
      if (std::optional<int64_t> value = GetEnumerationValue())
296
0
        return static_cast<T>(*value);
297
0
    return {};
298
346k
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_14FollowForkModeETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
13
  std::optional<T> GetValueAs() const {
274
13
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
13
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
13
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
13
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
13
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
13
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
13
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
13
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
13
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
13
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
13
    if constexpr (std::is_enum_v<T>)
295
13
      if (std::optional<int64_t> value = GetEnumerationValue())
296
13
        return static_cast<T>(*value);
297
0
    return {};
298
13
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_8ArchSpecETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
6.29k
  std::optional<T> GetValueAs() const {
274
6.29k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
6.29k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
6.29k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
6.29k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
6.29k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
6.29k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
6.29k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
6.29k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
6.29k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
6.29k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
6.29k
      return GetArchSpecValue();
294
0
    if constexpr (std::is_enum_v<T>)
295
0
      if (std::optional<int64_t> value = GetEnumerationValue())
296
0
        return static_cast<T>(*value);
297
0
    return {};
298
6.29k
  }
_ZNK12lldb_private11OptionValue10GetValueAsIN4lldb16DynamicValueTypeETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
51.6k
  std::optional<T> GetValueAs() const {
274
51.6k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
51.6k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
51.6k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
51.6k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
51.6k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
51.6k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
51.6k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
51.6k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
51.6k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
51.6k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
51.6k
    if constexpr (std::is_enum_v<T>)
295
51.6k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
51.6k
        return static_cast<T>(*value);
297
0
    return {};
298
51.6k
  }
_ZNK12lldb_private11OptionValue10GetValueAsI20x86DisassemblyFlavorTnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
46.4k
  std::optional<T> GetValueAs() const {
274
46.4k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
46.4k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
46.4k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
46.4k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
46.4k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
46.4k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
46.4k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
46.4k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
46.4k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
46.4k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
46.4k
    if constexpr (std::is_enum_v<T>)
295
46.4k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
46.4k
        return static_cast<T>(*value);
297
0
    return {};
298
46.4k
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_14InlineStrategyETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
1.15k
  std::optional<T> GetValueAs() const {
274
1.15k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
1.15k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
1.15k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
1.15k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
1.15k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
1.15k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
1.15k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
1.15k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
1.15k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
1.15k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
1.15k
    if constexpr (std::is_enum_v<T>)
295
1.15k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
1.15k
        return static_cast<T>(*value);
297
0
    return {};
298
1.15k
  }
_ZNK12lldb_private11OptionValue10GetValueAsIN4llvm9StringRefETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
32.5k
  std::optional<T> GetValueAs() const {
274
32.5k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
32.5k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
32.5k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
32.5k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
32.5k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
32.5k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
32.5k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
32.5k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
32.5k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
32.5k
      return GetStringValue();
292
0
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
0
    if constexpr (std::is_enum_v<T>)
295
0
      if (std::optional<int64_t> value = GetEnumerationValue())
296
0
        return static_cast<T>(*value);
297
0
    return {};
298
32.5k
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_15ImportStdModuleETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
7.55k
  std::optional<T> GetValueAs() const {
274
7.55k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
7.55k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
7.55k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
7.55k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
7.55k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
7.55k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
7.55k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
7.55k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
7.55k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
7.55k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
7.55k
    if constexpr (std::is_enum_v<T>)
295
7.55k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
7.55k
        return static_cast<T>(*value);
297
0
    return {};
298
7.55k
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_22DynamicClassInfoHelperETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
985
  std::optional<T> GetValueAs() const {
274
985
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
985
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
985
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
985
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
985
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
985
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
985
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
985
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
985
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
985
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
985
    if constexpr (std::is_enum_v<T>)
295
985
      if (std::optional<int64_t> value = GetEnumerationValue())
296
985
        return static_cast<T>(*value);
297
0
    return {};
298
985
  }
_ZNK12lldb_private11OptionValue10GetValueAsIxTnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS2_8optionalIS4_EEv
Line
Count
Source
273
9.73k
  std::optional<T> GetValueAs() const {
274
9.73k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
9.73k
    if constexpr (std::is_same_v<T, int64_t>)
277
9.73k
      return GetSInt64Value();
278
0
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
0
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
0
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
0
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
0
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
0
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
0
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
0
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
0
    if constexpr (std::is_enum_v<T>)
295
0
      if (std::optional<int64_t> value = GetEnumerationValue())
296
0
        return static_cast<T>(*value);
297
0
    return {};
298
9.73k
  }
_ZNK12lldb_private11OptionValue10GetValueAsIN4lldb12LanguageTypeETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
11.4k
  std::optional<T> GetValueAs() const {
274
11.4k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
11.4k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
11.4k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
11.4k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
11.4k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
11.4k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
11.4k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
11.4k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
11.4k
      return GetLanguageValue();
290
0
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
0
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
0
    if constexpr (std::is_enum_v<T>)
295
0
      if (std::optional<int64_t> value = GetEnumerationValue())
296
0
        return static_cast<T>(*value);
297
0
    return {};
298
0
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_21LoadScriptFromSymFileETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
233k
  std::optional<T> GetValueAs() const {
274
233k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
233k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
233k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
233k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
233k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
233k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
233k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
233k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
233k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
233k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
233k
    if constexpr (std::is_enum_v<T>)
295
233k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
233k
        return static_cast<T>(*value);
297
18.4E
    return {};
298
233k
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_19LoadCWDlldbinitFileETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
2
  std::optional<T> GetValueAs() const {
274
2
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
2
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
2
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
2
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
2
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
2
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
2
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
2
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
2
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
2
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
2
    if constexpr (std::is_enum_v<T>)
295
2
      if (std::optional<int64_t> value = GetEnumerationValue())
296
2
        return static_cast<T>(*value);
297
0
    return {};
298
2
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_12Disassembler17HexImmediateStyleETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
975k
  std::optional<T> GetValueAs() const {
274
975k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
975k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
975k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
975k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
975k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
975k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
975k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
975k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
975k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
975k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
975k
    if constexpr (std::is_enum_v<T>)
295
975k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
975k
        return static_cast<T>(*value);
297
0
    return {};
298
975k
  }
_ZNK12lldb_private11OptionValue10GetValueAsINS_21MemoryModuleLoadLevelETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
6
  std::optional<T> GetValueAs() const {
274
6
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
6
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
6
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
6
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
6
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
6
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
6
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
6
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
6
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
6
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
6
    if constexpr (std::is_enum_v<T>)
295
6
      if (std::optional<int64_t> value = GetEnumerationValue())
296
6
        return static_cast<T>(*value);
297
0
    return {};
298
6
  }
_ZNK12lldb_private11OptionValue10GetValueAsI13KASLRScanTypeTnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS3_8optionalIS5_EEv
Line
Count
Source
273
284
  std::optional<T> GetValueAs() const {
274
284
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
284
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
284
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
284
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
284
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
284
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
284
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
284
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
284
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
284
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
284
    if constexpr (std::is_enum_v<T>)
295
284
      if (std::optional<int64_t> value = GetEnumerationValue())
296
284
        return static_cast<T>(*value);
297
0
    return {};
298
284
  }
JITLoaderGDB.cpp:_ZNK12lldb_private11OptionValue10GetValueAsIN12_GLOBAL__N_118EnableJITLoaderGDBETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS4_8optionalIS6_EEv
Line
Count
Source
273
2.32k
  std::optional<T> GetValueAs() const {
274
2.32k
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
2.32k
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
2.32k
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
2.32k
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
2.32k
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
2.32k
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
2.32k
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
2.32k
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
2.32k
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
2.32k
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
2.32k
    if constexpr (std::is_enum_v<T>)
295
2.32k
      if (std::optional<int64_t> value = GetEnumerationValue())
296
2.32k
        return static_cast<T>(*value);
297
0
    return {};
298
2.32k
  }
_ZNK12lldb_private11OptionValue10GetValueAsIN4llvm6Triple15EnvironmentTypeETnNSt3__19enable_ifIXntsr3stdE12is_pointer_vIT_EEbE4typeELb1EEENS5_8optionalIS7_EEv
Line
Count
Source
273
61
  std::optional<T> GetValueAs() const {
274
61
    if constexpr (std::is_same_v<T, uint64_t>)
275
0
      return GetUInt64Value();
276
61
    if constexpr (std::is_same_v<T, int64_t>)
277
0
      return GetSInt64Value();
278
61
    if constexpr (std::is_same_v<T, bool>)
279
0
      return GetBooleanValue();
280
61
    if constexpr (std::is_same_v<T, char>)
281
0
      return GetCharValue();
282
61
    if constexpr (std::is_same_v<T, lldb::Format>)
283
0
      return GetFormatValue();
284
61
    if constexpr (std::is_same_v<T, FileSpec>)
285
0
      return GetFileSpecValue();
286
61
    if constexpr (std::is_same_v<T, FileSpecList>)
287
0
      return GetFileSpecListValue();
288
61
    if constexpr (std::is_same_v<T, lldb::LanguageType>)
289
0
      return GetLanguageValue();
290
61
    if constexpr (std::is_same_v<T, llvm::StringRef>)
291
0
      return GetStringValue();
292
61
    if constexpr (std::is_same_v<T, ArchSpec>)
293
0
      return GetArchSpecValue();
294
61
    if constexpr (std::is_enum_v<T>)
295
61
      if (std::optional<int64_t> value = GetEnumerationValue())
296
61
        return static_cast<T>(*value);
297
0
    return {};
298
61
  }
299
300
  template <typename T,
301
            typename U = typename std::remove_const<
302
                typename std::remove_pointer<T>::type>::type,
303
            std::enable_if_t<std::is_pointer_v<T>, bool> = true>
304
1.00M
  T GetValueAs() const {
305
1.00M
    if constexpr (std::is_same_v<U, FormatEntity::Entry>)
306
1.00M
      
return0
GetFormatEntity();
307
227
    
if constexpr (0
std::is_same_v<U, RegularExpression>)
308
227
      
return0
GetRegexValue();
309
0
    return {};
310
1.00M
  }
_ZNK12lldb_private11OptionValue10GetValueAsIPKNS_12FormatEntity5EntryES3_TnNSt3__19enable_ifIXsr3stdE12is_pointer_vIT_EEbE4typeELb1EEES8_v
Line
Count
Source
304
1.00M
  T GetValueAs() const {
305
1.00M
    if constexpr (std::is_same_v<U, FormatEntity::Entry>)
306
1.00M
      return GetFormatEntity();
307
0
    if constexpr (std::is_same_v<U, RegularExpression>)
308
0
      return GetRegexValue();
309
0
    return {};
310
1.00M
  }
_ZNK12lldb_private11OptionValue10GetValueAsIPKNS_17RegularExpressionES2_TnNSt3__19enable_ifIXsr3stdE12is_pointer_vIT_EEbE4typeELb1EEES7_v
Line
Count
Source
304
227
  T GetValueAs() const {
305
227
    if constexpr (std::is_same_v<U, FormatEntity::Entry>)
306
0
      return GetFormatEntity();
307
227
    if constexpr (std::is_same_v<U, RegularExpression>)
308
227
      return GetRegexValue();
309
0
    return {};
310
227
  }
311
312
6.61k
  bool SetValueAs(bool v) { return SetBooleanValue(v); }
313
314
0
  bool SetValueAs(char v) { return SetCharValue(v); }
315
316
38
  bool SetValueAs(uint64_t v) { return SetUInt64Value(v); }
317
318
0
  bool SetValueAs(int64_t v) { return SetSInt64Value(v); }
319
320
0
  bool SetValueAs(UUID v) { return SetUUIDValue(v); }
321
322
11.7k
  bool SetValueAs(llvm::StringRef v) { return SetStringValue(v); }
323
324
2
  bool SetValueAs(lldb::LanguageType v) { return SetLanguageValue(v); }
325
326
0
  bool SetValueAs(lldb::Format v) { return SetFormatValue(v); }
327
328
11.8k
  bool SetValueAs(FileSpec v) { return SetFileSpecValue(v); }
329
330
4
  bool SetValueAs(ArchSpec v) { return SetArchSpecValue(v); }
331
332
  template <typename T, std::enable_if_t<std::is_enum_v<T>, bool> = true>
333
50
  bool SetValueAs(T t) {
334
50
    return SetEnumerationValue(t);
335
50
  }
_ZN12lldb_private11OptionValue10SetValueAsIN4lldb14ScriptLanguageETnNSt3__19enable_ifIXsr3stdE9is_enum_vIT_EEbE4typeELb1EEEbS6_
Line
Count
Source
333
18
  bool SetValueAs(T t) {
334
18
    return SetEnumerationValue(t);
335
18
  }
_ZN12lldb_private11OptionValue10SetValueAsIN4lldb16DynamicValueTypeETnNSt3__19enable_ifIXsr3stdE9is_enum_vIT_EEbE4typeELb1EEEbS6_
Line
Count
Source
333
32
  bool SetValueAs(T t) {
334
32
    return SetEnumerationValue(t);
335
32
  }
336
337
protected:
338
  using TopmostBase = OptionValue;
339
340
  // Must be overriden by a derived class for correct downcasting the result of
341
  // DeepCopy to it. Inherit from Cloneable to avoid doing this manually.
342
  virtual lldb::OptionValueSP Clone() const = 0;
343
344
  lldb::OptionValueWP m_parent_wp;
345
  std::function<void()> m_callback;
346
  bool m_value_was_set = false; // This can be used to see if a value has been
347
                                // set by a call to SetValueFromCString(). It is
348
                                // often handy to know if an option value was
349
                                // set from the command line or as a setting,
350
                                // versus if we just have the default value that
351
                                // was already populated in the option value.
352
private:
353
  std::optional<ArchSpec> GetArchSpecValue() const;
354
  bool SetArchSpecValue(ArchSpec arch_spec);
355
356
  std::optional<bool> GetBooleanValue() const;
357
  bool SetBooleanValue(bool new_value);
358
359
  std::optional<char> GetCharValue() const;
360
  bool SetCharValue(char new_value);
361
362
  std::optional<int64_t> GetEnumerationValue() const;
363
  bool SetEnumerationValue(int64_t value);
364
365
  std::optional<FileSpec> GetFileSpecValue() const;
366
  bool SetFileSpecValue(FileSpec file_spec);
367
368
  std::optional<FileSpecList> GetFileSpecListValue() const;
369
370
  std::optional<int64_t> GetSInt64Value() const;
371
  bool SetSInt64Value(int64_t new_value);
372
373
  std::optional<uint64_t> GetUInt64Value() const;
374
  bool SetUInt64Value(uint64_t new_value);
375
376
  std::optional<lldb::Format> GetFormatValue() const;
377
  bool SetFormatValue(lldb::Format new_value);
378
379
  std::optional<lldb::LanguageType> GetLanguageValue() const;
380
  bool SetLanguageValue(lldb::LanguageType new_language);
381
382
  std::optional<llvm::StringRef> GetStringValue() const;
383
  bool SetStringValue(llvm::StringRef new_value);
384
385
  std::optional<UUID> GetUUIDValue() const;
386
  bool SetUUIDValue(const UUID &uuid);
387
388
  const FormatEntity::Entry *GetFormatEntity() const;
389
  const RegularExpression *GetRegexValue() const;
390
  
391
  mutable std::mutex m_mutex;
392
};
393
394
} // namespace lldb_private
395
396
#endif // LLDB_INTERPRETER_OPTIONVALUE_H