xref: /freebsd/contrib/llvm-project/lldb/bindings/macros.swig (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1%define STRING_EXTENSION_LEVEL_OUTSIDE(Class, Level)
2%extend lldb:: ## Class ## {
3  std::string __repr__(){
4    lldb::SBStream stream;
5    $self->GetDescription (stream, Level);
6    const char *desc = stream.GetData();
7    size_t desc_len = stream.GetSize();
8    if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) {
9      --desc_len;
10    }
11    return std::string(desc, desc_len);
12  }
13}
14%enddef
15
16%define STRING_EXTENSION_OUTSIDE(Class)
17%extend lldb:: ## Class ## {
18  std::string __repr__(){
19    lldb::SBStream stream;
20    $self->GetDescription (stream);
21    const char *desc = stream.GetData();
22    size_t desc_len = stream.GetSize();
23    if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) {
24      --desc_len;
25    }
26    return std::string(desc, desc_len);
27  }
28}
29%enddef
30