Fix cxx
This commit is contained in:
parent
5a06ca1ed7
commit
494153fe86
1 changed files with 25 additions and 12 deletions
|
|
@ -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,11 +866,17 @@ 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;
|
||||
|
|
@ -882,13 +888,20 @@ public:
|
|||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue