[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 08:23:27 +01:00
|
|
|
//===-- SBMemoryRegionInfoList.cpp ----------------------------------------===//
|
2016-06-23 08:35:37 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00: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
|
2016-06-23 08:35:37 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBMemoryRegionInfoList.h"
|
2019-03-06 00:06:00 +00:00
|
|
|
#include "SBReproducerPrivate.h"
|
2017-03-03 20:56:28 +00:00
|
|
|
#include "lldb/API/SBMemoryRegionInfo.h"
|
2016-06-23 08:35:37 +00:00
|
|
|
#include "lldb/API/SBStream.h"
|
|
|
|
#include "lldb/Target/MemoryRegionInfo.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
class MemoryRegionInfoListImpl {
|
|
|
|
public:
|
|
|
|
MemoryRegionInfoListImpl() : m_regions() {}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2016-06-23 08:35:37 +00:00
|
|
|
MemoryRegionInfoListImpl(const MemoryRegionInfoListImpl &rhs)
|
|
|
|
: m_regions(rhs.m_regions) {}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2016-06-23 08:35:37 +00:00
|
|
|
MemoryRegionInfoListImpl &operator=(const MemoryRegionInfoListImpl &rhs) {
|
|
|
|
if (this == &rhs)
|
|
|
|
return *this;
|
|
|
|
m_regions = rhs.m_regions;
|
|
|
|
return *this;
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2018-12-20 15:02:58 +00:00
|
|
|
size_t GetSize() const { return m_regions.size(); }
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2018-12-20 15:02:58 +00:00
|
|
|
void Reserve(size_t capacity) { return m_regions.reserve(capacity); }
|
|
|
|
|
|
|
|
void Append(const MemoryRegionInfo &sb_region) {
|
2016-06-23 08:35:37 +00:00
|
|
|
m_regions.push_back(sb_region);
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2016-06-23 08:35:37 +00:00
|
|
|
void Append(const MemoryRegionInfoListImpl &list) {
|
2018-12-20 15:02:58 +00:00
|
|
|
Reserve(GetSize() + list.GetSize());
|
|
|
|
|
|
|
|
for (const auto &val : list.m_regions)
|
2016-06-23 08:35:37 +00:00
|
|
|
Append(val);
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2016-06-23 08:35:37 +00:00
|
|
|
void Clear() { m_regions.clear(); }
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2018-12-20 15:02:58 +00:00
|
|
|
bool GetMemoryRegionInfoAtIndex(size_t index,
|
|
|
|
MemoryRegionInfo ®ion_info) {
|
2016-06-23 08:35:37 +00:00
|
|
|
if (index >= GetSize())
|
|
|
|
return false;
|
|
|
|
region_info = m_regions[index];
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-12-20 15:02:58 +00:00
|
|
|
MemoryRegionInfos &Ref() { return m_regions; }
|
|
|
|
|
|
|
|
const MemoryRegionInfos &Ref() const { return m_regions; }
|
|
|
|
|
2016-06-23 08:35:37 +00:00
|
|
|
private:
|
2018-12-20 15:02:58 +00:00
|
|
|
MemoryRegionInfos m_regions;
|
2016-06-23 08:35:37 +00:00
|
|
|
};
|
|
|
|
|
2019-02-13 06:25:41 +00:00
|
|
|
MemoryRegionInfos &SBMemoryRegionInfoList::ref() { return m_opaque_up->Ref(); }
|
2018-12-20 15:02:58 +00:00
|
|
|
|
|
|
|
const MemoryRegionInfos &SBMemoryRegionInfoList::ref() const {
|
2019-02-13 06:25:41 +00:00
|
|
|
return m_opaque_up->Ref();
|
2018-12-20 15:02:58 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 08:35:37 +00:00
|
|
|
SBMemoryRegionInfoList::SBMemoryRegionInfoList()
|
2019-03-06 00:06:00 +00:00
|
|
|
: m_opaque_up(new MemoryRegionInfoListImpl()) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBMemoryRegionInfoList);
|
|
|
|
}
|
2016-06-23 08:35:37 +00:00
|
|
|
|
|
|
|
SBMemoryRegionInfoList::SBMemoryRegionInfoList(
|
|
|
|
const SBMemoryRegionInfoList &rhs)
|
2019-03-06 00:06:00 +00:00
|
|
|
: m_opaque_up(new MemoryRegionInfoListImpl(*rhs.m_opaque_up)) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBMemoryRegionInfoList,
|
|
|
|
(const lldb::SBMemoryRegionInfoList &), rhs);
|
|
|
|
}
|
2016-06-23 08:35:37 +00:00
|
|
|
|
|
|
|
SBMemoryRegionInfoList::~SBMemoryRegionInfoList() {}
|
|
|
|
|
|
|
|
const SBMemoryRegionInfoList &SBMemoryRegionInfoList::
|
|
|
|
operator=(const SBMemoryRegionInfoList &rhs) {
|
2019-03-06 00:06:00 +00:00
|
|
|
LLDB_RECORD_METHOD(
|
|
|
|
const lldb::SBMemoryRegionInfoList &,
|
|
|
|
SBMemoryRegionInfoList, operator=,(const lldb::SBMemoryRegionInfoList &),
|
|
|
|
rhs);
|
|
|
|
|
2016-06-23 08:35:37 +00:00
|
|
|
if (this != &rhs) {
|
2019-02-13 06:25:41 +00:00
|
|
|
*m_opaque_up = *rhs.m_opaque_up;
|
2016-06-23 08:35:37 +00:00
|
|
|
}
|
2019-04-03 21:31:22 +00:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2016-06-23 08:35:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t SBMemoryRegionInfoList::GetSize() const {
|
2019-03-06 00:06:00 +00:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBMemoryRegionInfoList, GetSize);
|
|
|
|
|
2019-02-13 06:25:41 +00:00
|
|
|
return m_opaque_up->GetSize();
|
2016-06-23 08:35:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBMemoryRegionInfoList::GetMemoryRegionAtIndex(
|
|
|
|
uint32_t idx, SBMemoryRegionInfo ®ion_info) {
|
2019-03-06 00:06:00 +00:00
|
|
|
LLDB_RECORD_METHOD(bool, SBMemoryRegionInfoList, GetMemoryRegionAtIndex,
|
|
|
|
(uint32_t, lldb::SBMemoryRegionInfo &), idx, region_info);
|
|
|
|
|
2019-03-07 22:47:13 +00:00
|
|
|
return m_opaque_up->GetMemoryRegionInfoAtIndex(idx, region_info.ref());
|
2016-06-23 08:35:37 +00:00
|
|
|
}
|
|
|
|
|
2019-03-06 00:06:00 +00:00
|
|
|
void SBMemoryRegionInfoList::Clear() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBMemoryRegionInfoList, Clear);
|
|
|
|
|
|
|
|
m_opaque_up->Clear();
|
|
|
|
}
|
2016-06-23 08:35:37 +00:00
|
|
|
|
|
|
|
void SBMemoryRegionInfoList::Append(SBMemoryRegionInfo &sb_region) {
|
2019-03-06 00:06:00 +00:00
|
|
|
LLDB_RECORD_METHOD(void, SBMemoryRegionInfoList, Append,
|
|
|
|
(lldb::SBMemoryRegionInfo &), sb_region);
|
|
|
|
|
2019-02-13 06:25:41 +00:00
|
|
|
m_opaque_up->Append(sb_region.ref());
|
2016-06-23 08:35:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBMemoryRegionInfoList::Append(SBMemoryRegionInfoList &sb_region_list) {
|
2019-03-06 00:06:00 +00:00
|
|
|
LLDB_RECORD_METHOD(void, SBMemoryRegionInfoList, Append,
|
|
|
|
(lldb::SBMemoryRegionInfoList &), sb_region_list);
|
|
|
|
|
2019-02-13 06:25:41 +00:00
|
|
|
m_opaque_up->Append(*sb_region_list);
|
2016-06-23 08:35:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const MemoryRegionInfoListImpl *SBMemoryRegionInfoList::operator->() const {
|
2019-02-13 06:25:41 +00:00
|
|
|
return m_opaque_up.get();
|
2016-06-23 08:35:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const MemoryRegionInfoListImpl &SBMemoryRegionInfoList::operator*() const {
|
2019-02-13 06:25:41 +00:00
|
|
|
assert(m_opaque_up.get());
|
|
|
|
return *m_opaque_up;
|
2016-06-23 08:35:37 +00:00
|
|
|
}
|
2019-03-19 17:13:13 +00:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBMemoryRegionInfoList>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBMemoryRegionInfoList, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBMemoryRegionInfoList,
|
|
|
|
(const lldb::SBMemoryRegionInfoList &));
|
|
|
|
LLDB_REGISTER_METHOD(
|
|
|
|
const lldb::SBMemoryRegionInfoList &,
|
|
|
|
SBMemoryRegionInfoList, operator=,(
|
|
|
|
const lldb::SBMemoryRegionInfoList &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(uint32_t, SBMemoryRegionInfoList, GetSize, ());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBMemoryRegionInfoList, GetMemoryRegionAtIndex,
|
|
|
|
(uint32_t, lldb::SBMemoryRegionInfo &));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBMemoryRegionInfoList, Clear, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBMemoryRegionInfoList, Append,
|
|
|
|
(lldb::SBMemoryRegionInfo &));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBMemoryRegionInfoList, Append,
|
|
|
|
(lldb::SBMemoryRegionInfoList &));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|