LLDB mainline
SBScriptObject.cpp
Go to the documentation of this file.
1//===-- SBScriptObject.cpp ------------------------------------------------===//
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
11#include "Utils.h"
12
15
16using namespace lldb;
17using namespace lldb_private;
18
21 : m_opaque_up(std::make_unique<lldb_private::ScriptObject>(ptr, lang)) {
22 LLDB_INSTRUMENT_VA(this, ptr, lang);
23}
24
26 : m_opaque_up(new ScriptObject(nullptr, eScriptLanguageNone)) {
27 LLDB_INSTRUMENT_VA(this, rhs);
28
30}
32
34 LLDB_INSTRUMENT_VA(this, rhs);
35
36 if (this != &rhs)
38 return *this;
39}
40
42 LLDB_INSTRUMENT_VA(this, rhs);
43
44 return !(m_opaque_up == rhs.m_opaque_up);
45}
46
49
50 return this->operator bool();
51}
52
53SBScriptObject::operator bool() const {
55
56 return m_opaque_up != nullptr && m_opaque_up->operator bool();
57}
58
61
62 return m_opaque_up ? const_cast<void *>(m_opaque_up->GetPointer()) : nullptr;
63}
64
67
68 return m_opaque_up ? m_opaque_up->GetLanguage() : eScriptLanguageNone;
69}
70
72 if (m_opaque_up == nullptr)
73 m_opaque_up = std::make_unique<ScriptObject>(nullptr, eScriptLanguageNone);
74 return *m_opaque_up;
75}
76
78 // This object should already have checked with "IsValid()" prior to calling
79 // this function. In case you didn't we will assert and die to let you know.
80 assert(m_opaque_up.get());
81 return *m_opaque_up;
82}
83
#define LLDB_INSTRUMENT_VA(...)
lldb::ScriptLanguage GetLanguage() const
lldb::ScriptObjectPtr GetPointer() const
SBScriptObject(const ScriptObjectPtr ptr, lldb::ScriptLanguage lang)
lldb_private::ScriptObject & ref()
bool operator!=(const SBScriptObject &rhs) const
lldb_private::ScriptObject * get()
const lldb::SBScriptObject & operator=(const lldb::SBScriptObject &rhs)
std::unique_ptr< lldb_private::ScriptObject > m_opaque_up
A class that represents a running process on the host machine.
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
Definition: Utils.h:17
Definition: SBAddress.h:15
ScriptLanguage
Script interpreter types.
@ eScriptLanguageNone
void * ScriptObjectPtr
Definition: lldb-types.h:78