[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
|
|
|
//===-- SBExecutionContext.cpp --------------------------------------------===//
|
2014-10-02 04:43:45 +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
|
2014-10-02 04:43:45 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBExecutionContext.h"
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "SBReproducerPrivate.h"
|
2014-10-02 04:43:45 +08:00
|
|
|
|
|
|
|
#include "lldb/API/SBFrame.h"
|
|
|
|
#include "lldb/API/SBProcess.h"
|
|
|
|
#include "lldb/API/SBTarget.h"
|
|
|
|
#include "lldb/API/SBThread.h"
|
|
|
|
|
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBExecutionContext::SBExecutionContext() : m_exe_ctx_sp() {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBExecutionContext);
|
|
|
|
}
|
2014-10-02 04:43:45 +08:00
|
|
|
|
|
|
|
SBExecutionContext::SBExecutionContext(const lldb::SBExecutionContext &rhs)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_exe_ctx_sp(rhs.m_exe_ctx_sp) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBExecutionContext,
|
|
|
|
(const lldb::SBExecutionContext &), rhs);
|
|
|
|
}
|
2014-10-02 04:43:45 +08:00
|
|
|
|
2014-10-02 05:47:29 +08:00
|
|
|
SBExecutionContext::SBExecutionContext(
|
|
|
|
lldb::ExecutionContextRefSP exe_ctx_ref_sp)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_exe_ctx_sp(exe_ctx_ref_sp) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBExecutionContext, (lldb::ExecutionContextRefSP),
|
|
|
|
exe_ctx_ref_sp);
|
|
|
|
}
|
2014-10-02 05:47:29 +08:00
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
SBExecutionContext::SBExecutionContext(const lldb::SBTarget &target)
|
|
|
|
: m_exe_ctx_sp(new ExecutionContextRef()) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBExecutionContext, (const lldb::SBTarget &), target);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
m_exe_ctx_sp->SetTargetSP(target.GetSP());
|
|
|
|
}
|
|
|
|
|
|
|
|
SBExecutionContext::SBExecutionContext(const lldb::SBProcess &process)
|
|
|
|
: m_exe_ctx_sp(new ExecutionContextRef()) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBExecutionContext, (const lldb::SBProcess &),
|
|
|
|
process);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
m_exe_ctx_sp->SetProcessSP(process.GetSP());
|
|
|
|
}
|
|
|
|
|
|
|
|
SBExecutionContext::SBExecutionContext(lldb::SBThread thread)
|
|
|
|
: m_exe_ctx_sp(new ExecutionContextRef()) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBExecutionContext, (lldb::SBThread), thread);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
m_exe_ctx_sp->SetThreadPtr(thread.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
SBExecutionContext::SBExecutionContext(const lldb::SBFrame &frame)
|
|
|
|
: m_exe_ctx_sp(new ExecutionContextRef()) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBExecutionContext, (const lldb::SBFrame &), frame);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
m_exe_ctx_sp->SetFrameSP(frame.GetFrameSP());
|
|
|
|
}
|
|
|
|
|
2020-02-18 14:57:06 +08:00
|
|
|
SBExecutionContext::~SBExecutionContext() = default;
|
2014-10-02 04:43:45 +08:00
|
|
|
|
|
|
|
const SBExecutionContext &SBExecutionContext::
|
|
|
|
operator=(const lldb::SBExecutionContext &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(
|
|
|
|
const lldb::SBExecutionContext &,
|
|
|
|
SBExecutionContext, operator=,(const lldb::SBExecutionContext &), rhs);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
m_exe_ctx_sp = rhs.m_exe_ctx_sp;
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2014-10-02 04:43:45 +08:00
|
|
|
}
|
|
|
|
|
2014-10-14 09:20:07 +08:00
|
|
|
ExecutionContextRef *SBExecutionContext::get() const {
|
|
|
|
return m_exe_ctx_sp.get();
|
|
|
|
}
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
SBTarget SBExecutionContext::GetTarget() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBTarget, SBExecutionContext,
|
|
|
|
GetTarget);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
SBTarget sb_target;
|
|
|
|
if (m_exe_ctx_sp) {
|
|
|
|
TargetSP target_sp(m_exe_ctx_sp->GetTargetSP());
|
|
|
|
if (target_sp)
|
|
|
|
sb_target.SetSP(target_sp);
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_target);
|
2014-10-02 04:43:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBProcess SBExecutionContext::GetProcess() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBProcess, SBExecutionContext,
|
|
|
|
GetProcess);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
SBProcess sb_process;
|
|
|
|
if (m_exe_ctx_sp) {
|
|
|
|
ProcessSP process_sp(m_exe_ctx_sp->GetProcessSP());
|
|
|
|
if (process_sp)
|
|
|
|
sb_process.SetSP(process_sp);
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_process);
|
2014-10-02 04:43:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThread SBExecutionContext::GetThread() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBThread, SBExecutionContext,
|
|
|
|
GetThread);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
SBThread sb_thread;
|
|
|
|
if (m_exe_ctx_sp) {
|
|
|
|
ThreadSP thread_sp(m_exe_ctx_sp->GetThreadSP());
|
|
|
|
if (thread_sp)
|
|
|
|
sb_thread.SetThread(thread_sp);
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_thread);
|
2014-10-02 04:43:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBFrame SBExecutionContext::GetFrame() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFrame, SBExecutionContext, GetFrame);
|
|
|
|
|
2014-10-02 04:43:45 +08:00
|
|
|
SBFrame sb_frame;
|
|
|
|
if (m_exe_ctx_sp) {
|
|
|
|
StackFrameSP frame_sp(m_exe_ctx_sp->GetFrameSP());
|
|
|
|
if (frame_sp)
|
|
|
|
sb_frame.SetFrameSP(frame_sp);
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_frame);
|
2014-10-02 04:43:45 +08:00
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBExecutionContext>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBExecutionContext, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBExecutionContext,
|
|
|
|
(const lldb::SBExecutionContext &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBExecutionContext,
|
|
|
|
(lldb::ExecutionContextRefSP));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBExecutionContext, (const lldb::SBTarget &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBExecutionContext, (const lldb::SBProcess &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBExecutionContext, (lldb::SBThread));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBExecutionContext, (const lldb::SBFrame &));
|
|
|
|
LLDB_REGISTER_METHOD(
|
|
|
|
const lldb::SBExecutionContext &,
|
|
|
|
SBExecutionContext, operator=,(const lldb::SBExecutionContext &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBTarget, SBExecutionContext, GetTarget,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBProcess, SBExecutionContext, GetProcess,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBThread, SBExecutionContext, GetThread,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBFrame, SBExecutionContext, GetFrame, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|