1 //===-- SWIGPythonBridge.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 9 #include "lldb/Host/Config.h" 10 #include "lldb/lldb-enumerations.h" 11 12 #if LLDB_ENABLE_PYTHON 13 14 // LLDB Python header must be included first 15 #include "lldb-python.h" 16 17 #include "SWIGPythonBridge.h" 18 19 using namespace lldb; 20 21 namespace lldb_private { 22 23 template <typename T> const char *GetPythonValueFormatString(T t); 24 template <> const char *GetPythonValueFormatString(char *) { return "s"; } 25 template <> const char *GetPythonValueFormatString(char) { return "b"; } 26 template <> const char *GetPythonValueFormatString(unsigned char) { 27 return "B"; 28 } 29 template <> const char *GetPythonValueFormatString(short) { return "h"; } 30 template <> const char *GetPythonValueFormatString(unsigned short) { 31 return "H"; 32 } 33 template <> const char *GetPythonValueFormatString(int) { return "i"; } 34 template <> const char *GetPythonValueFormatString(unsigned int) { return "I"; } 35 template <> const char *GetPythonValueFormatString(long) { return "l"; } 36 template <> const char *GetPythonValueFormatString(unsigned long) { 37 return "k"; 38 } 39 template <> const char *GetPythonValueFormatString(long long) { return "L"; } 40 template <> const char *GetPythonValueFormatString(unsigned long long) { 41 return "K"; 42 } 43 template <> const char *GetPythonValueFormatString(float) { return "f"; } 44 template <> const char *GetPythonValueFormatString(double) { return "d"; } 45 46 } // namespace lldb_private 47 48 #endif // LLDB_ENABLE_PYTHON 49