This commit is contained in:
Joey Yakimowich-Payne 2023-02-18 00:43:25 -07:00
commit 494153fe86
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1

View file

@ -843,7 +843,7 @@ class cxx_function_wrapper
{
public:
// Call can_wrap() to check if this wrapper can be emitted later.
explicit cxx_function_wrapper(cxx_wrappers& cxx_wrappers, Node* n, Parm* p) : cxx_wrappers_(cxx_wrappers) {
explicit cxx_function_wrapper(cxx_wrappers& cxx_wrappers, Node* n, Parm* parms) : cxx_wrappers_(cxx_wrappers) {
func_node = NULL;
except_check_start =
@ -866,29 +866,42 @@ public:
parms_cxx = NewStringEmpty();
parms_call = NewStringEmpty();
if (p) {
if (parms) {
// We want to use readable parameter names in our wrappers instead of the autogenerated arg$N if possible, so do it, and do it before calling
// Swig_typemap_attach_parms(), as this uses the parameter names for typemap expansion.
for (Parm* p2 = p; p2; p2 = nextSibling(p2)) {
String* name = Getattr(p2, "name");
Parm *p;
int index = 1;
String *lname = 0;
std::map<int, int> strmap;
for (p = (Parm*)parms, index = 1; p; (p = nextSibling(p)), index++) {
String* name = Getattr(p, "name");
if (!name) {
// Can't do anything for unnamed parameters.
continue;
}
// Static variables use fully qualified names, so we need to strip the scope from them.
scoped_dohptr name_ptr;
if (Strstr(name, "::")) {
name_ptr = Swig_scopename_last(name);
name = name_ptr.get();
}
Setattr(p, "lname", name);
scoped_dohptr name_ptr;
if (Strstr(name, "::")) {
name_ptr = Swig_scopename_last(name);
name = name_ptr.get();
}
if (strmap.count(Hashval(name))) {
strmap[Hashval(name)]++;
String* nname = NewStringf("%s%d", name, strmap[Hashval(name)]);
Setattr(p, "lname", nname);
}
else {
Setattr(p, "lname", name);
strmap[Hashval(name)] = 1;
}
}
Swig_typemap_attach_parms("cxxin", p, NULL);
for (; p; p = Getattr(p, "tmap:in:next")) {
for (p = parms; p; p = Getattr(p, "tmap:in:next")) {
if (Checkattr(p, "tmap:in:numinputs", "0"))
continue;