[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
|
|
|
//===-- SBFileSpecList.cpp ------------------------------------------------===//
|
2011-09-21 09:17:13 +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
|
2011-09-21 09:17:13 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "lldb/API/SBFileSpecList.h"
|
|
|
|
#include "SBReproducerPrivate.h"
|
2019-03-06 08:05:55 +08:00
|
|
|
#include "Utils.h"
|
2011-09-21 09:17:13 +08:00
|
|
|
#include "lldb/API/SBFileSpec.h"
|
|
|
|
#include "lldb/API/SBStream.h"
|
|
|
|
#include "lldb/Core/FileSpecList.h"
|
2017-03-23 01:33:23 +08:00
|
|
|
#include "lldb/Host/PosixApi.h"
|
2017-03-23 02:40:07 +08:00
|
|
|
#include "lldb/Utility/FileSpec.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2011-09-21 09:17:13 +08:00
|
|
|
|
2021-05-26 18:19:37 +08:00
|
|
|
#include <climits>
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2011-09-21 09:17:13 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBFileSpecList::SBFileSpecList() : m_opaque_up(new FileSpecList()) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBFileSpecList);
|
|
|
|
}
|
2011-09-21 09:17:13 +08:00
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
SBFileSpecList::SBFileSpecList(const SBFileSpecList &rhs) : m_opaque_up() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBFileSpecList, (const lldb::SBFileSpecList &), rhs);
|
|
|
|
|
2011-09-21 09:17:13 +08:00
|
|
|
|
2019-03-06 08:05:55 +08:00
|
|
|
m_opaque_up = clone(rhs.m_opaque_up);
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
2020-02-18 14:57:06 +08:00
|
|
|
SBFileSpecList::~SBFileSpecList() = default;
|
2011-09-21 09:17:13 +08:00
|
|
|
|
|
|
|
const SBFileSpecList &SBFileSpecList::operator=(const SBFileSpecList &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(const lldb::SBFileSpecList &,
|
|
|
|
SBFileSpecList, operator=,(const lldb::SBFileSpecList &),
|
|
|
|
rhs);
|
|
|
|
|
2019-03-06 08:05:55 +08:00
|
|
|
if (this != &rhs)
|
|
|
|
m_opaque_up = clone(rhs.m_opaque_up);
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
uint32_t SBFileSpecList::GetSize() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBFileSpecList, GetSize);
|
|
|
|
|
|
|
|
return m_opaque_up->GetSize();
|
|
|
|
}
|
2011-09-21 09:17:13 +08:00
|
|
|
|
|
|
|
void SBFileSpecList::Append(const SBFileSpec &sb_file) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBFileSpecList, Append, (const lldb::SBFileSpec &),
|
|
|
|
sb_file);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_opaque_up->Append(sb_file.ref());
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBFileSpecList::AppendIfUnique(const SBFileSpec &sb_file) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBFileSpecList, AppendIfUnique,
|
|
|
|
(const lldb::SBFileSpec &), sb_file);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->AppendIfUnique(sb_file.ref());
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
void SBFileSpecList::Clear() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBFileSpecList, Clear);
|
|
|
|
|
|
|
|
m_opaque_up->Clear();
|
|
|
|
}
|
2011-09-21 09:17:13 +08:00
|
|
|
|
2011-09-23 08:54:11 +08:00
|
|
|
uint32_t SBFileSpecList::FindFileIndex(uint32_t idx, const SBFileSpec &sb_file,
|
|
|
|
bool full) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(uint32_t, SBFileSpecList, FindFileIndex,
|
|
|
|
(uint32_t, const lldb::SBFileSpec &, bool), idx, sb_file,
|
|
|
|
full);
|
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up->FindFileIndex(idx, sb_file.ref(), full);
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const SBFileSpec SBFileSpecList::GetFileSpecAtIndex(uint32_t idx) const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST(const lldb::SBFileSpec, SBFileSpecList,
|
|
|
|
GetFileSpecAtIndex, (uint32_t), idx);
|
|
|
|
|
2011-09-21 09:17:13 +08:00
|
|
|
SBFileSpec new_spec;
|
2019-02-13 14:25:41 +08:00
|
|
|
new_spec.SetFileSpec(m_opaque_up->GetFileSpecAtIndex(idx));
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(new_spec);
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const lldb_private::FileSpecList *SBFileSpecList::operator->() const {
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up.get();
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const lldb_private::FileSpecList *SBFileSpecList::get() const {
|
2019-02-13 14:25:41 +08:00
|
|
|
return m_opaque_up.get();
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const lldb_private::FileSpecList &SBFileSpecList::operator*() const {
|
2019-02-13 14:25:41 +08:00
|
|
|
return *m_opaque_up;
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const lldb_private::FileSpecList &SBFileSpecList::ref() const {
|
2019-02-13 14:25:41 +08:00
|
|
|
return *m_opaque_up;
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBFileSpecList::GetDescription(SBStream &description) const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST(bool, SBFileSpecList, GetDescription,
|
|
|
|
(lldb::SBStream &), description);
|
|
|
|
|
2011-11-13 14:57:31 +08:00
|
|
|
Stream &strm = description.ref();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_opaque_up) {
|
|
|
|
uint32_t num_files = m_opaque_up->GetSize();
|
2011-11-13 14:57:31 +08:00
|
|
|
strm.Printf("%d files: ", num_files);
|
2011-09-21 09:17:13 +08:00
|
|
|
for (uint32_t i = 0; i < num_files; i++) {
|
|
|
|
char path[PATH_MAX];
|
2019-02-13 14:25:41 +08:00
|
|
|
if (m_opaque_up->GetFileSpecAtIndex(i).GetPath(path, sizeof(path)))
|
2011-11-13 14:57:31 +08:00
|
|
|
strm.Printf("\n %s", path);
|
2011-09-21 09:17:13 +08:00
|
|
|
}
|
|
|
|
} else
|
2011-11-13 14:57:31 +08:00
|
|
|
strm.PutCString("No value");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-09-21 09:17:13 +08:00
|
|
|
return true;
|
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBFileSpecList>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBFileSpecList, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBFileSpecList, (const lldb::SBFileSpecList &));
|
|
|
|
LLDB_REGISTER_METHOD(
|
|
|
|
const lldb::SBFileSpecList &,
|
|
|
|
SBFileSpecList, operator=,(const lldb::SBFileSpecList &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(uint32_t, SBFileSpecList, GetSize, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBFileSpecList, Append,
|
|
|
|
(const lldb::SBFileSpec &));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBFileSpecList, AppendIfUnique,
|
|
|
|
(const lldb::SBFileSpec &));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBFileSpecList, Clear, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBFileSpecList, FindFileIndex,
|
|
|
|
(uint32_t, const lldb::SBFileSpec &, bool));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(const lldb::SBFileSpec, SBFileSpecList,
|
|
|
|
GetFileSpecAtIndex, (uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBFileSpecList, GetDescription,
|
|
|
|
(lldb::SBStream &));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|