[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
|
|
|
//===-- Queue.cpp ---------------------------------------------------------===//
|
2013-12-13 08:29:16 +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
|
2013-12-13 08:29:16 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Target/Queue.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/QueueList.h"
|
2014-02-05 13:44:54 +08:00
|
|
|
#include "lldb/Target/SystemRuntime.h"
|
2013-12-13 08:29:16 +08:00
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
Queue::Queue(ProcessSP process_sp, lldb::queue_id_t queue_id,
|
|
|
|
const char *queue_name)
|
|
|
|
: m_process_wp(), m_queue_id(queue_id), m_queue_name(),
|
2014-02-05 13:44:54 +08:00
|
|
|
m_running_work_items_count(0), m_pending_work_items_count(0),
|
2014-03-13 10:54:54 +08:00
|
|
|
m_pending_items(), m_dispatch_queue_t_addr(LLDB_INVALID_ADDRESS),
|
|
|
|
m_kind(eQueueKindUnknown) {
|
2013-12-19 08:09:13 +08:00
|
|
|
if (queue_name)
|
|
|
|
m_queue_name = queue_name;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-12-18 08:58:23 +08:00
|
|
|
m_process_wp = process_sp;
|
2013-12-13 08:29:16 +08:00
|
|
|
}
|
|
|
|
|
2016-02-19 02:52:47 +08:00
|
|
|
Queue::~Queue() = default;
|
2013-12-13 08:29:16 +08:00
|
|
|
|
|
|
|
queue_id_t Queue::GetID() { return m_queue_id; }
|
|
|
|
|
|
|
|
const char *Queue::GetName() {
|
2016-02-19 02:52:47 +08:00
|
|
|
return (m_queue_name.empty() ? nullptr : m_queue_name.c_str());
|
2013-12-13 08:29:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t Queue::GetIndexID() { return m_queue_id; }
|
|
|
|
|
|
|
|
std::vector<lldb::ThreadSP> Queue::GetThreads() {
|
|
|
|
std::vector<ThreadSP> result;
|
|
|
|
ProcessSP process_sp = m_process_wp.lock();
|
2016-02-19 02:52:47 +08:00
|
|
|
if (process_sp) {
|
2013-12-13 08:29:16 +08:00
|
|
|
for (ThreadSP thread_sp : process_sp->Threads()) {
|
|
|
|
if (thread_sp->GetQueueID() == m_queue_id) {
|
|
|
|
result.push_back(thread_sp);
|
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-12-13 08:29:16 +08:00
|
|
|
return result;
|
|
|
|
}
|
2014-02-05 13:44:54 +08:00
|
|
|
|
|
|
|
void Queue::SetNumRunningWorkItems(uint32_t count) {
|
|
|
|
m_running_work_items_count = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t Queue::GetNumRunningWorkItems() const {
|
|
|
|
return m_running_work_items_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queue::SetNumPendingWorkItems(uint32_t count) {
|
|
|
|
m_pending_work_items_count = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t Queue::GetNumPendingWorkItems() const {
|
|
|
|
return m_pending_work_items_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queue::SetLibdispatchQueueAddress(addr_t dispatch_queue_t_addr) {
|
|
|
|
m_dispatch_queue_t_addr = dispatch_queue_t_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
addr_t Queue::GetLibdispatchQueueAddress() const {
|
|
|
|
return m_dispatch_queue_t_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<lldb::QueueItemSP> &Queue::GetPendingItems() {
|
2016-02-19 02:52:47 +08:00
|
|
|
if (m_pending_items.empty()) {
|
2014-02-05 13:44:54 +08:00
|
|
|
ProcessSP process_sp = m_process_wp.lock();
|
|
|
|
if (process_sp && process_sp->GetSystemRuntime()) {
|
|
|
|
process_sp->GetSystemRuntime()->PopulatePendingItemsForQueue(this);
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-02-05 13:44:54 +08:00
|
|
|
return m_pending_items;
|
|
|
|
}
|
2014-03-13 10:54:54 +08:00
|
|
|
|
|
|
|
lldb::QueueKind Queue::GetKind() { return m_kind; }
|
|
|
|
|
|
|
|
void Queue::SetKind(lldb::QueueKind kind) { m_kind = kind; }
|