Skip to content

Commit 896e53a

Browse files
committed
Fix SWIG
1 parent 10a1755 commit 896e53a

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

lldb/bindings/headers.swig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@
3939
#include "lldb/API/SBHostOS.h"
4040
#include "lldb/API/SBInstruction.h"
4141
#include "lldb/API/SBInstructionList.h"
42-
#include "lldb/API/SBLanguages.h"
4342
#include "lldb/API/SBLanguageRuntime.h"
43+
#include "lldb/API/SBLanguages.h"
4444
#include "lldb/API/SBLaunchInfo.h"
4545
#include "lldb/API/SBLineEntry.h"
4646
#include "lldb/API/SBListener.h"
47+
#include "lldb/API/SBLock.h"
4748
#include "lldb/API/SBMemoryRegionInfo.h"
4849
#include "lldb/API/SBMemoryRegionInfoList.h"
4950
#include "lldb/API/SBModule.h"

lldb/bindings/interfaces.swig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,12 @@
121121
%include "lldb/API/SBHostOS.h"
122122
%include "lldb/API/SBInstruction.h"
123123
%include "lldb/API/SBInstructionList.h"
124-
%include "lldb/API/SBLanguages.h"
125124
%include "lldb/API/SBLanguageRuntime.h"
125+
%include "lldb/API/SBLanguages.h"
126126
%include "lldb/API/SBLaunchInfo.h"
127127
%include "lldb/API/SBLineEntry.h"
128128
%include "lldb/API/SBListener.h"
129+
%include "lldb/API/SBLock.h"
129130
%include "lldb/API/SBMemoryRegionInfo.h"
130131
%include "lldb/API/SBMemoryRegionInfoList.h"
131132
%include "lldb/API/SBModule.h"

lldb/include/lldb/API/SBLock.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ struct APILock;
1919

2020
namespace lldb {
2121

22-
#ifndef SWIG
2322
class LLDB_API SBLock {
2423
public:
24+
SBLock();
25+
SBLock(SBLock &&rhs);
26+
SBLock &operator=(SBLock &&rhs);
2527
~SBLock();
2628

2729
bool IsValid() const;
2830

2931
private:
30-
SBLock() = default;
31-
3232
// Private constructor used by SBTarget to create the Target API lock.
3333
// Requires a friend declaration.
3434
SBLock(lldb::TargetSP target_sp);
@@ -42,5 +42,3 @@ class LLDB_API SBLock {
4242
#endif
4343

4444
} // namespace lldb
45-
46-
#endif

lldb/include/lldb/API/SBTarget.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,7 @@ class LLDB_API SBTarget {
946946
/// An error if a Trace already exists or the trace couldn't be created.
947947
lldb::SBTrace CreateTrace(SBError &error);
948948

949-
#ifndef SWIG
950949
lldb::SBLock AcquireAPILock() const;
951-
#endif
952950

953951
protected:
954952
friend class SBAddress;

lldb/source/API/SBLock.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@
1111
#include "lldb/Utility/Instrumentation.h"
1212
#include "lldb/lldb-forward.h"
1313
#include <memory>
14-
#include <mutex>
1514

1615
using namespace lldb;
1716
using namespace lldb_private;
1817

18+
SBLock::SBLock() {}
19+
SBLock::SBLock(SBLock &&rhs) : m_opaque_up(std::move(rhs.m_opaque_up)) {}
20+
21+
SBLock &SBLock::operator=(SBLock &&rhs) {
22+
m_opaque_up = std::move(rhs.m_opaque_up);
23+
return *this;
24+
}
25+
1926
SBLock::SBLock(lldb::TargetSP target_sp)
2027
: m_opaque_up(std::make_unique<TargetAPILock>(target_sp)) {
2128
LLDB_INSTRUMENT_VA(this);

lldb/source/API/SBTarget.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,12 +2434,10 @@ lldb::SBTrace SBTarget::CreateTrace(lldb::SBError &error) {
24342434
return SBTrace();
24352435
}
24362436

2437-
#ifndef SWIG
24382437
lldb::SBLock SBTarget::AcquireAPILock() const {
24392438
LLDB_INSTRUMENT_VA(this);
24402439

24412440
if (TargetSP target_sp = GetSP())
24422441
return lldb::SBLock(target_sp);
24432442
return lldb::SBLock();
24442443
}
2445-
#endif

lldb/unittests/API/SBLockTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ using namespace lldb;
2121
using namespace lldb_private;
2222

2323
class SBLockTest : public testing::Test {
24+
protected:
25+
void SetUp() override { debugger = SBDebugger::Create(); }
26+
void TearDown() override { SBDebugger::Destroy(debugger); }
27+
2428
SubsystemRAII<lldb::SBDebugger> subsystems;
29+
SBDebugger debugger;
2530
};
2631

2732
TEST_F(SBLockTest, LockTest) {
28-
lldb::SBDebugger debugger = lldb::SBDebugger::Create();
2933
lldb::SBTarget target = debugger.GetDummyTarget();
3034

3135
std::future<void> f;
@@ -50,6 +54,4 @@ TEST_F(SBLockTest, LockTest) {
5054
ASSERT_TRUE(locked.exchange(false));
5155
}
5256
f.wait();
53-
54-
lldb::SBDebugger::Destroy(debugger);
5557
}

0 commit comments

Comments
 (0)