reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
//===-- SBVariablesOptions.cpp --------------------------------------*- C++
//-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/API/SBVariablesOptions.h"
#include "SBReproducerPrivate.h"
#include "lldb/API/SBTarget.h"
#include "lldb/Target/Target.h"

#include "lldb/lldb-private.h"

using namespace lldb;
using namespace lldb_private;

class VariablesOptionsImpl {
public:
  VariablesOptionsImpl()
      : m_include_arguments(false), m_include_locals(false),
        m_include_statics(false), m_in_scope_only(false),
        m_include_runtime_support_values(false),
        m_include_recognized_arguments(eLazyBoolCalculate),
        m_use_dynamic(lldb::eNoDynamicValues) {}

  VariablesOptionsImpl(const VariablesOptionsImpl &) = default;

  ~VariablesOptionsImpl() = default;

  VariablesOptionsImpl &operator=(const VariablesOptionsImpl &) = default;

  bool GetIncludeArguments() const { return m_include_arguments; }

  void SetIncludeArguments(bool b) { m_include_arguments = b; }

  bool GetIncludeRecognizedArguments(const lldb::TargetSP &target_sp) const {
    if (m_include_recognized_arguments != eLazyBoolCalculate)
        return m_include_recognized_arguments;
    return target_sp ? target_sp->GetDisplayRecognizedArguments() : false;
  }

  void SetIncludeRecognizedArguments(bool b) {
    m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
  }

  bool GetIncludeLocals() const { return m_include_locals; }

  void SetIncludeLocals(bool b) { m_include_locals = b; }

  bool GetIncludeStatics() const { return m_include_statics; }

  void SetIncludeStatics(bool b) { m_include_statics = b; }

  bool GetInScopeOnly() const { return m_in_scope_only; }

  void SetInScopeOnly(bool b) { m_in_scope_only = b; }

  bool GetIncludeRuntimeSupportValues() const {
    return m_include_runtime_support_values;
  }

  void SetIncludeRuntimeSupportValues(bool b) {
    m_include_runtime_support_values = b;
  }

  lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }

  void SetUseDynamic(lldb::DynamicValueType d) { m_use_dynamic = d; }

private:
  bool m_include_arguments : 1;
  bool m_include_locals : 1;
  bool m_include_statics : 1;
  bool m_in_scope_only : 1;
  bool m_include_runtime_support_values : 1;
  LazyBool m_include_recognized_arguments; // can be overridden with a setting
  lldb::DynamicValueType m_use_dynamic;
};

SBVariablesOptions::SBVariablesOptions()
    : m_opaque_up(new VariablesOptionsImpl()) {
  LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBVariablesOptions);
}

SBVariablesOptions::SBVariablesOptions(const SBVariablesOptions &options)
    : m_opaque_up(new VariablesOptionsImpl(options.ref())) {
  LLDB_RECORD_CONSTRUCTOR(SBVariablesOptions,
                          (const lldb::SBVariablesOptions &), options);
}

SBVariablesOptions &SBVariablesOptions::
operator=(const SBVariablesOptions &options) {
  LLDB_RECORD_METHOD(
      lldb::SBVariablesOptions &,
      SBVariablesOptions, operator=,(const lldb::SBVariablesOptions &),
      options);

  m_opaque_up.reset(new VariablesOptionsImpl(options.ref()));
  return LLDB_RECORD_RESULT(*this);
}

SBVariablesOptions::~SBVariablesOptions() = default;

bool SBVariablesOptions::IsValid() const {
  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, IsValid);
  return this->operator bool();
}
SBVariablesOptions::operator bool() const {
  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, operator bool);

  return m_opaque_up != nullptr;
}

bool SBVariablesOptions::GetIncludeArguments() const {
  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions,
                                   GetIncludeArguments);

  return m_opaque_up->GetIncludeArguments();
}

void SBVariablesOptions::SetIncludeArguments(bool arguments) {
  LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeArguments, (bool),
                     arguments);

  m_opaque_up->SetIncludeArguments(arguments);
}

bool SBVariablesOptions::GetIncludeRecognizedArguments(
    const lldb::SBTarget &target) const {
  LLDB_RECORD_METHOD_CONST(bool, SBVariablesOptions,
                           GetIncludeRecognizedArguments,
                           (const lldb::SBTarget &), target);

  return m_opaque_up->GetIncludeRecognizedArguments(target.GetSP());
}

void SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) {
  LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeRecognizedArguments,
                     (bool), arguments);

  m_opaque_up->SetIncludeRecognizedArguments(arguments);
}

bool SBVariablesOptions::GetIncludeLocals() const {
  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetIncludeLocals);

  return m_opaque_up->GetIncludeLocals();
}

void SBVariablesOptions::SetIncludeLocals(bool locals) {
  LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeLocals, (bool),
                     locals);

  m_opaque_up->SetIncludeLocals(locals);
}

bool SBVariablesOptions::GetIncludeStatics() const {
  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetIncludeStatics);

  return m_opaque_up->GetIncludeStatics();
}

void SBVariablesOptions::SetIncludeStatics(bool statics) {
  LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeStatics, (bool),
                     statics);

  m_opaque_up->SetIncludeStatics(statics);
}

bool SBVariablesOptions::GetInScopeOnly() const {
  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetInScopeOnly);

  return m_opaque_up->GetInScopeOnly();
}

void SBVariablesOptions::SetInScopeOnly(bool in_scope_only) {
  LLDB_RECORD_METHOD(void, SBVariablesOptions, SetInScopeOnly, (bool),
                     in_scope_only);

  m_opaque_up->SetInScopeOnly(in_scope_only);
}

bool SBVariablesOptions::GetIncludeRuntimeSupportValues() const {
  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions,
                                   GetIncludeRuntimeSupportValues);

  return m_opaque_up->GetIncludeRuntimeSupportValues();
}

void SBVariablesOptions::SetIncludeRuntimeSupportValues(
    bool runtime_support_values) {
  LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeRuntimeSupportValues,
                     (bool), runtime_support_values);

  m_opaque_up->SetIncludeRuntimeSupportValues(runtime_support_values);
}

lldb::DynamicValueType SBVariablesOptions::GetUseDynamic() const {
  LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::DynamicValueType, SBVariablesOptions,
                                   GetUseDynamic);

  return m_opaque_up->GetUseDynamic();
}

void SBVariablesOptions::SetUseDynamic(lldb::DynamicValueType dynamic) {
  LLDB_RECORD_METHOD(void, SBVariablesOptions, SetUseDynamic,
                     (lldb::DynamicValueType), dynamic);

  m_opaque_up->SetUseDynamic(dynamic);
}

VariablesOptionsImpl *SBVariablesOptions::operator->() {
  return m_opaque_up.operator->();
}

const VariablesOptionsImpl *SBVariablesOptions::operator->() const {
  return m_opaque_up.operator->();
}

VariablesOptionsImpl *SBVariablesOptions::get() { return m_opaque_up.get(); }

VariablesOptionsImpl &SBVariablesOptions::ref() { return *m_opaque_up; }

const VariablesOptionsImpl &SBVariablesOptions::ref() const {
  return *m_opaque_up;
}

SBVariablesOptions::SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr)
    : m_opaque_up(std::move(lldb_object_ptr)) {}

void SBVariablesOptions::SetOptions(VariablesOptionsImpl *lldb_object_ptr) {
  m_opaque_up.reset(std::move(lldb_object_ptr));
}

namespace lldb_private {
namespace repro {

template <>
void RegisterMethods<SBVariablesOptions>(Registry &R) {
  LLDB_REGISTER_CONSTRUCTOR(SBVariablesOptions, ());
  LLDB_REGISTER_CONSTRUCTOR(SBVariablesOptions,
                            (const lldb::SBVariablesOptions &));
  LLDB_REGISTER_METHOD(
      lldb::SBVariablesOptions &,
      SBVariablesOptions, operator=,(const lldb::SBVariablesOptions &));
  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, IsValid, ());
  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, operator bool, ());
  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, GetIncludeArguments,
                             ());
  LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetIncludeArguments, (bool));
  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions,
                             GetIncludeRecognizedArguments,
                             (const lldb::SBTarget &));
  LLDB_REGISTER_METHOD(void, SBVariablesOptions,
                       SetIncludeRecognizedArguments, (bool));
  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, GetIncludeLocals, ());
  LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetIncludeLocals, (bool));
  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, GetIncludeStatics, ());
  LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetIncludeStatics, (bool));
  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions, GetInScopeOnly, ());
  LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetInScopeOnly, (bool));
  LLDB_REGISTER_METHOD_CONST(bool, SBVariablesOptions,
                             GetIncludeRuntimeSupportValues, ());
  LLDB_REGISTER_METHOD(void, SBVariablesOptions,
                       SetIncludeRuntimeSupportValues, (bool));
  LLDB_REGISTER_METHOD_CONST(lldb::DynamicValueType, SBVariablesOptions,
                             GetUseDynamic, ());
  LLDB_REGISTER_METHOD(void, SBVariablesOptions, SetUseDynamic,
                       (lldb::DynamicValueType));
}

}
}