summaryrefslogtreecommitdiff
path: root/include/lldb/Utility/PythonPointer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Utility/PythonPointer.h')
-rw-r--r--include/lldb/Utility/PythonPointer.h73
1 files changed, 0 insertions, 73 deletions
diff --git a/include/lldb/Utility/PythonPointer.h b/include/lldb/Utility/PythonPointer.h
deleted file mode 100644
index fe90670fd2e15..0000000000000
--- a/include/lldb/Utility/PythonPointer.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//===---------------------PythonPointer.h ------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef utility_PythonPointer_h_
-#define utility_PythonPointer_h_
-
-#include <algorithm>
-
-#include "lldb/lldb-python.h"
-
-namespace lldb_private {
-
-template<class T>
-class PythonPointer
-{
-public:
- typedef PyObject* element_type;
-private:
- element_type* ptr_;
- bool my_ref;
-public:
-
- PythonPointer(element_type p, bool steal_ref = false) :
- ptr_(p),
- my_ref(!steal_ref)
- {
- if (my_ref)
- Py_INCREF(ptr_);
- }
-
- PythonPointer(const PythonPointer& r, bool steal_ref = false) :
- ptr_(r.ptr_),
- my_ref(!steal_ref)
- {
- if (my_ref)
- Py_INCREF(ptr_);
- }
-
- ~PythonPointer()
- {
- if (my_ref)
- Py_XDECREF(ptr_);
- }
-
- PythonPointer
- StealReference()
- {
- return PythonPointer(ptr_,true);
- }
-
- PythonPointer
- DuplicateReference()
- {
- return PythonPointer(ptr_, false);
- }
-
- element_type get() const {return ptr_;}
-
- bool IsNull() { return ptr_ == NULL; }
- bool IsNone() { return ptr_ == Py_None; }
-
- operator PyObject* () { return ptr_; }
-};
-
-} // namespace lldb
-
-#endif // utility_PythonPointer_h_