[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- SBVariablesOptions.cpp --------------------------------------------===//
|
2015-02-18 01:55:50 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// 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
|
2015-02-18 01:55:50 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBVariablesOptions.h"
|
2022-01-08 08:26:40 +08:00
|
|
|
#include "lldb/Utility/ReproducerInstrumentation.h"
|
2018-12-21 07:38:19 +08:00
|
|
|
#include "lldb/API/SBTarget.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
|
|
|
|
#include "lldb/lldb-private.h"
|
2015-02-18 01:55:50 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
class VariablesOptionsImpl {
|
|
|
|
public:
|
|
|
|
VariablesOptionsImpl()
|
2018-12-21 07:38:19 +08:00
|
|
|
: m_include_arguments(false), m_include_locals(false),
|
|
|
|
m_include_statics(false), m_in_scope_only(false),
|
|
|
|
m_include_runtime_support_values(false) {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
VariablesOptionsImpl(const VariablesOptionsImpl &) = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
~VariablesOptionsImpl() = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
VariablesOptionsImpl &operator=(const VariablesOptionsImpl &) = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
bool GetIncludeArguments() const { return m_include_arguments; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
void SetIncludeArguments(bool b) { m_include_arguments = b; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-12-21 07:38:19 +08:00
|
|
|
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;
|
2018-10-31 12:00:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetIncludeRecognizedArguments(bool b) {
|
2018-12-21 07:38:19 +08:00
|
|
|
m_include_recognized_arguments = b ? eLazyBoolYes : eLazyBoolNo;
|
2018-10-31 12:00:22 +08:00
|
|
|
}
|
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
bool GetIncludeLocals() const { return m_include_locals; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
void SetIncludeLocals(bool b) { m_include_locals = b; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
bool GetIncludeStatics() const { return m_include_statics; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
void SetIncludeStatics(bool b) { m_include_statics = b; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
bool GetInScopeOnly() const { return m_in_scope_only; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
void SetInScopeOnly(bool b) { m_in_scope_only = b; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
bool GetIncludeRuntimeSupportValues() const {
|
|
|
|
return m_include_runtime_support_values;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
void SetIncludeRuntimeSupportValues(bool b) {
|
|
|
|
m_include_runtime_support_values = b;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
lldb::DynamicValueType GetUseDynamic() const { return m_use_dynamic; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
void SetUseDynamic(lldb::DynamicValueType d) { m_use_dynamic = d; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
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;
|
2018-12-21 07:38:19 +08:00
|
|
|
LazyBool m_include_recognized_arguments =
|
|
|
|
eLazyBoolCalculate; // can be overridden with a setting
|
2015-02-18 01:55:50 +08:00
|
|
|
lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
|
|
|
|
};
|
|
|
|
|
|
|
|
SBVariablesOptions::SBVariablesOptions()
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_up(new VariablesOptionsImpl()) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBVariablesOptions);
|
|
|
|
}
|
2015-02-18 01:55:50 +08:00
|
|
|
|
|
|
|
SBVariablesOptions::SBVariablesOptions(const SBVariablesOptions &options)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_up(new VariablesOptionsImpl(options.ref())) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBVariablesOptions,
|
|
|
|
(const lldb::SBVariablesOptions &), options);
|
|
|
|
}
|
2015-02-18 01:55:50 +08:00
|
|
|
|
|
|
|
SBVariablesOptions &SBVariablesOptions::
|
|
|
|
operator=(const SBVariablesOptions &options) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(
|
|
|
|
lldb::SBVariablesOptions &,
|
|
|
|
SBVariablesOptions, operator=,(const lldb::SBVariablesOptions &),
|
|
|
|
options);
|
|
|
|
|
2020-06-25 07:25:05 +08:00
|
|
|
m_opaque_up = std::make_unique<VariablesOptionsImpl>(options.ref());
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBVariablesOptions::~SBVariablesOptions() = default;
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
bool SBVariablesOptions::IsValid() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, IsValid);
|
Add "operator bool" to SB APIs
Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.
This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.
In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.
Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58792
llvm-svn: 355824
2019-03-11 21:58:46 +08:00
|
|
|
return this->operator bool();
|
|
|
|
}
|
|
|
|
SBVariablesOptions::operator bool() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, operator bool);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
|
|
|
return m_opaque_up != nullptr;
|
|
|
|
}
|
2015-02-18 01:55:50 +08:00
|
|
|
|
|
|
|
bool SBVariablesOptions::GetIncludeArguments() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions,
|
|
|
|
GetIncludeArguments);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->GetIncludeArguments();
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBVariablesOptions::SetIncludeArguments(bool arguments) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeArguments, (bool),
|
|
|
|
arguments);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up->SetIncludeArguments(arguments);
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
2018-12-21 07:38:19 +08:00
|
|
|
bool SBVariablesOptions::GetIncludeRecognizedArguments(
|
|
|
|
const lldb::SBTarget &target) const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST(bool, SBVariablesOptions,
|
|
|
|
GetIncludeRecognizedArguments,
|
|
|
|
(const lldb::SBTarget &), target);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->GetIncludeRecognizedArguments(target.GetSP());
|
2018-10-31 12:00:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBVariablesOptions::SetIncludeRecognizedArguments(bool arguments) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeRecognizedArguments,
|
|
|
|
(bool), arguments);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up->SetIncludeRecognizedArguments(arguments);
|
2018-10-31 12:00:22 +08:00
|
|
|
}
|
|
|
|
|
2015-02-18 01:55:50 +08:00
|
|
|
bool SBVariablesOptions::GetIncludeLocals() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetIncludeLocals);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->GetIncludeLocals();
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBVariablesOptions::SetIncludeLocals(bool locals) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeLocals, (bool),
|
|
|
|
locals);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up->SetIncludeLocals(locals);
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBVariablesOptions::GetIncludeStatics() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetIncludeStatics);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->GetIncludeStatics();
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBVariablesOptions::SetIncludeStatics(bool statics) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeStatics, (bool),
|
|
|
|
statics);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up->SetIncludeStatics(statics);
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBVariablesOptions::GetInScopeOnly() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions, GetInScopeOnly);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->GetInScopeOnly();
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBVariablesOptions::SetInScopeOnly(bool in_scope_only) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBVariablesOptions, SetInScopeOnly, (bool),
|
|
|
|
in_scope_only);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up->SetInScopeOnly(in_scope_only);
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBVariablesOptions::GetIncludeRuntimeSupportValues() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBVariablesOptions,
|
|
|
|
GetIncludeRuntimeSupportValues);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->GetIncludeRuntimeSupportValues();
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBVariablesOptions::SetIncludeRuntimeSupportValues(
|
|
|
|
bool runtime_support_values) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBVariablesOptions, SetIncludeRuntimeSupportValues,
|
|
|
|
(bool), runtime_support_values);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up->SetIncludeRuntimeSupportValues(runtime_support_values);
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::DynamicValueType SBVariablesOptions::GetUseDynamic() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::DynamicValueType, SBVariablesOptions,
|
|
|
|
GetUseDynamic);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->GetUseDynamic();
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBVariablesOptions::SetUseDynamic(lldb::DynamicValueType dynamic) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBVariablesOptions, SetUseDynamic,
|
|
|
|
(lldb::DynamicValueType), dynamic);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up->SetUseDynamic(dynamic);
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
VariablesOptionsImpl *SBVariablesOptions::operator->() {
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up.operator->();
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const VariablesOptionsImpl *SBVariablesOptions::operator->() const {
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up.operator->();
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
VariablesOptionsImpl *SBVariablesOptions::get() { return m_opaque_up.get(); }
|
2015-02-18 01:55:50 +08:00
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
VariablesOptionsImpl &SBVariablesOptions::ref() { return *m_opaque_up; }
|
2015-02-18 01:55:50 +08:00
|
|
|
|
|
|
|
const VariablesOptionsImpl &SBVariablesOptions::ref() const {
|
2019-02-13 14:25:41 +08:00
|
|
|
return *m_opaque_up;
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBVariablesOptions::SBVariablesOptions(VariablesOptionsImpl *lldb_object_ptr)
|
2019-02-13 14:25:41 +08:00
|
|
|
: m_opaque_up(std::move(lldb_object_ptr)) {}
|
2015-02-18 01:55:50 +08:00
|
|
|
|
|
|
|
void SBVariablesOptions::SetOptions(VariablesOptionsImpl *lldb_object_ptr) {
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up.reset(std::move(lldb_object_ptr));
|
2015-02-18 01:55:50 +08:00
|
|
|
}
|