LLDB  mainline
SBThreadCollection.cpp
Go to the documentation of this file.
1 //===-- SBThreadCollection.cpp ----------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "SBReproducerPrivate.h"
11 #include "lldb/API/SBThread.h"
12 #include "lldb/Target/ThreadList.h"
13 
14 using namespace lldb;
15 using namespace lldb_private;
16 
19 }
20 
22  : m_opaque_sp(rhs.m_opaque_sp) {
24  (const lldb::SBThreadCollection &), rhs);
25 }
26 
31  SBThreadCollection, operator=,(const lldb::SBThreadCollection &), rhs);
32 
33  if (this != &rhs)
34  m_opaque_sp = rhs.m_opaque_sp;
35  return LLDB_RECORD_RESULT(*this);
36 }
37 
38 SBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads)
39  : m_opaque_sp(threads) {}
40 
42 
43 void SBThreadCollection::SetOpaque(const lldb::ThreadCollectionSP &threads) {
44  m_opaque_sp = threads;
45 }
46 
48  return m_opaque_sp.get();
49 }
50 
52  return m_opaque_sp.operator->();
53 }
54 
55 lldb::ThreadCollectionSP &SBThreadCollection::operator*() {
56  return m_opaque_sp;
57 }
58 
59 const lldb::ThreadCollectionSP &SBThreadCollection::operator*() const {
60  return m_opaque_sp;
61 }
62 
65  return this->operator bool();
66 }
67 SBThreadCollection::operator bool() const {
69 
70  return m_opaque_sp.get() != NULL;
71 }
72 
75 
76  if (m_opaque_sp)
77  return m_opaque_sp->GetSize();
78  return 0;
79 }
80 
83  (size_t), idx);
84 
85  SBThread thread;
86  if (m_opaque_sp && idx < m_opaque_sp->GetSize())
87  thread = m_opaque_sp->GetThreadAtIndex(idx);
88  return LLDB_RECORD_RESULT(thread);
89 }
90 
91 namespace lldb_private {
92 namespace repro {
93 
94 template <>
98  (const lldb::SBThreadCollection &));
100  const lldb::SBThreadCollection &,
101  SBThreadCollection, operator=,(const lldb::SBThreadCollection &));
103  LLDB_REGISTER_METHOD_CONST(bool, SBThreadCollection, operator bool, ());
106  (size_t));
107 }
108 
109 }
110 }
lldb_private::ThreadCollection * get() const
The registry contains a unique mapping between functions and their ID.
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
lldb::SBThread GetThreadAtIndex(size_t idx)
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
lldb::ThreadCollectionSP & operator*()
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
void SetOpaque(const lldb::ThreadCollectionSP &threads)
const SBThreadCollection & operator=(const SBThreadCollection &rhs)
lldb_private::ThreadCollection * operator->() const
Definition: SBAddress.h:15
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
#define LLDB_RECORD_RESULT(Result)
void RegisterMethods< SBThreadCollection >(Registry &R)
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)