[lldb/SWIG] Refactor extensions to be non Python-specific (2/2)
The current SWIG extensions for the string conversion operator is Python
specific because it uses the PythonObjects. This means that the code
cannot be reused for other SWIG supported languages such as Lua.
This reimplements the extensions in a more generic way that can be
reused. It uses a SWIG macro to reduce code duplication.
Differential revision: https://reviews.llvm.org/D72377
(cherry picked from commit ae47a3d8107856c84c104f3c2e43a553f4e36748)