xref: /freebsd/contrib/llvm-project/lldb/bindings/python/python-swigsafecast.swig (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1namespace lldb_private {
2namespace python {
3
4PythonObject ToSWIGHelper(void *obj, swig_type_info *info) {
5  return {PyRefType::Owned, SWIG_NewPointerObj(obj, info, SWIG_POINTER_OWN)};
6}
7
8PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBValue> value_sb) {
9  return ToSWIGHelper(value_sb.release(), SWIGTYPE_p_lldb__SBValue);
10}
11
12PythonObject ToSWIGWrapper(lldb::ValueObjectSP value_sp) {
13  return ToSWIGWrapper(std::make_unique<lldb::SBValue>(std::move(value_sp)));
14}
15
16PythonObject ToSWIGWrapper(lldb::TargetSP target_sp) {
17  return ToSWIGHelper(new lldb::SBTarget(std::move(target_sp)),
18                      SWIGTYPE_p_lldb__SBTarget);
19}
20
21PythonObject ToSWIGWrapper(lldb::ProcessSP process_sp) {
22  return ToSWIGHelper(new lldb::SBProcess(std::move(process_sp)),
23                      SWIGTYPE_p_lldb__SBProcess);
24}
25
26PythonObject ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp) {
27  return ToSWIGHelper(new lldb::SBThreadPlan(std::move(thread_plan_sp)),
28                      SWIGTYPE_p_lldb__SBThreadPlan);
29}
30
31PythonObject ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp) {
32  return ToSWIGHelper(new lldb::SBBreakpoint(std::move(breakpoint_sp)),
33                      SWIGTYPE_p_lldb__SBBreakpoint);
34}
35
36PythonObject ToSWIGWrapper(const Status& status) {
37  return ToSWIGHelper(new lldb::SBError(status), SWIGTYPE_p_lldb__SBError);
38}
39
40PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBStream> stream_sb) {
41  return ToSWIGHelper(stream_sb.release(), SWIGTYPE_p_lldb__SBStream);
42}
43
44PythonObject ToSWIGWrapper(std::unique_ptr<lldb::SBStructuredData> data_sb) {
45  return ToSWIGHelper(data_sb.release(), SWIGTYPE_p_lldb__SBStructuredData);
46}
47
48PythonObject ToSWIGWrapper(const StructuredDataImpl &data_impl) {
49  return ToSWIGWrapper(std::make_unique<lldb::SBStructuredData>(data_impl));
50}
51
52PythonObject ToSWIGWrapper(lldb::ThreadSP thread_sp) {
53  return ToSWIGHelper(new lldb::SBThread(std::move(thread_sp)),
54                      SWIGTYPE_p_lldb__SBThread);
55}
56
57PythonObject ToSWIGWrapper(lldb::StackFrameSP frame_sp) {
58  return ToSWIGHelper(new lldb::SBFrame(std::move(frame_sp)),
59                      SWIGTYPE_p_lldb__SBFrame);
60}
61
62PythonObject ToSWIGWrapper(lldb::DebuggerSP debugger_sp) {
63  return ToSWIGHelper(new lldb::SBDebugger(std::move(debugger_sp)),
64                      SWIGTYPE_p_lldb__SBDebugger);
65}
66
67PythonObject ToSWIGWrapper(lldb::WatchpointSP watchpoint_sp) {
68  return ToSWIGHelper(new lldb::SBWatchpoint(std::move(watchpoint_sp)),
69                      SWIGTYPE_p_lldb__SBWatchpoint);
70}
71
72PythonObject ToSWIGWrapper(lldb::BreakpointLocationSP bp_loc_sp) {
73  return ToSWIGHelper(new lldb::SBBreakpointLocation(std::move(bp_loc_sp)),
74                      SWIGTYPE_p_lldb__SBBreakpointLocation);
75}
76
77PythonObject ToSWIGWrapper(lldb::ExecutionContextRefSP ctx_sp) {
78  return ToSWIGHelper(new lldb::SBExecutionContext(std::move(ctx_sp)),
79                      SWIGTYPE_p_lldb__SBExecutionContext);
80}
81
82PythonObject ToSWIGWrapper(lldb::TypeImplSP type_impl_sp) {
83  return ToSWIGHelper(new lldb::SBType(type_impl_sp), SWIGTYPE_p_lldb__SBType);
84}
85
86PythonObject ToSWIGWrapper(const TypeSummaryOptions &summary_options) {
87  return ToSWIGHelper(new lldb::SBTypeSummaryOptions(summary_options),
88                      SWIGTYPE_p_lldb__SBTypeSummaryOptions);
89}
90
91PythonObject ToSWIGWrapper(const SymbolContext &sym_ctx) {
92  return ToSWIGHelper(new lldb::SBSymbolContext(sym_ctx),
93                      SWIGTYPE_p_lldb__SBSymbolContext);
94}
95
96ScopedPythonObject<lldb::SBCommandReturnObject>
97ToSWIGWrapper(CommandReturnObject &cmd_retobj) {
98  return ScopedPythonObject<lldb::SBCommandReturnObject>(
99      new lldb::SBCommandReturnObject(cmd_retobj),
100      SWIGTYPE_p_lldb__SBCommandReturnObject);
101}
102
103ScopedPythonObject<lldb::SBEvent> ToSWIGWrapper(Event *event) {
104  return ScopedPythonObject<lldb::SBEvent>(new lldb::SBEvent(event),
105                                           SWIGTYPE_p_lldb__SBEvent);
106}
107
108} // namespace python
109} // namespace lldb_private
110