diff options
author | Enrico Granata <egranata@apple.com> | 2013-07-09 20:14:26 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2013-07-09 20:14:26 +0000 |
commit | eff81a471acdf888e3cf5bc6550bd62b465d4e06 (patch) | |
tree | dc00802f687af8148091b6a2441f142b3f0f690d /lldb/scripts/Python/python-swigsafecast.swig | |
parent | 61a56d7a3a7813f0961a522f1dc980bcf27fcfbb (diff) | |
download | bcm5719-llvm-eff81a471acdf888e3cf5bc6550bd62b465d4e06.tar.gz bcm5719-llvm-eff81a471acdf888e3cf5bc6550bd62b465d4e06.zip |
Second attempt at getting the PyCallable changes in trunk
Thanks to Daniel Malea for helping test this patch for Linux happiness!
llvm-svn: 185965
Diffstat (limited to 'lldb/scripts/Python/python-swigsafecast.swig')
-rw-r--r-- | lldb/scripts/Python/python-swigsafecast.swig | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/lldb/scripts/Python/python-swigsafecast.swig b/lldb/scripts/Python/python-swigsafecast.swig index 7ee658fb458..da7444c9b96 100644 --- a/lldb/scripts/Python/python-swigsafecast.swig +++ b/lldb/scripts/Python/python-swigsafecast.swig @@ -1,7 +1,3 @@ -#ifndef __cplusplus -#error needs C++ to build these -#endif - // leaving this undefined ensures we will get a linker error if we try to use SBTypeToSWIGWrapper() // for a type for which we did not specialze this function template <typename SBClass> @@ -15,6 +11,38 @@ SBTypeToSWIGWrapper (SBClass& sb_object) return SBTypeToSWIGWrapper(&sb_object); } +template <typename SBClass> +PyObject* +SBTypeToSWIGWrapper (const SBClass& sb_object) +{ + return SBTypeToSWIGWrapper(&sb_object); +} + +template <> +PyObject* +SBTypeToSWIGWrapper (PyObject* py_object) +{ + return py_object; +} + +template <> +PyObject* +SBTypeToSWIGWrapper (const char* c_str) +{ + if (c_str) + return PyString_FromString(c_str); + return NULL; +} + +template <> +PyObject* +SBTypeToSWIGWrapper (unsigned int* c_int) +{ + if (!c_int) + return NULL; + return PyInt_FromLong(*c_int); +} + template <> PyObject* SBTypeToSWIGWrapper (lldb::SBProcess* process_sb) |