Resolve typedefs in parameter types after applying ctype typemap
Typedefs were not resolved for non-object types in spite of SwigType_typedef_resolve_all() call as it didn't affect "c_parm_type". Actually it is not even clear if resolving typedefs is a good idea as using them probably makes the generated code more clear, but at least in the case of nested typedefs we do need to do it as "Class::Type" can't appear in C code.
This commit is contained in:
parent
f533e3c488
commit
8eba14c6e0
2 changed files with 8 additions and 5 deletions
|
|
@ -817,16 +817,20 @@ ready:
|
|||
String *c_parm_type = 0;
|
||||
String *arg_name = NewString("");
|
||||
|
||||
SwigType *tdtype = SwigType_typedef_resolve_all(type);
|
||||
if (tdtype)
|
||||
type = tdtype;
|
||||
|
||||
Printf(arg_name, "c%s", lname);
|
||||
|
||||
if ((tm = Getattr(p, "tmap:ctype"))) { // set the appropriate type for parameter
|
||||
c_parm_type = Copy(tm);
|
||||
substituteResolvedType(wrapper ? output_wrapper_def : output_wrapper_decl, type, c_parm_type);
|
||||
|
||||
// We prefer to keep typedefs in the wrapper functions signatures as it makes them more readable, but we can't do it for nested typedefs as
|
||||
// they're not valid in C, so resolve them in this case.
|
||||
if (strstr(Char(c_parm_type), "::")) {
|
||||
SwigType* const tdtype = SwigType_typedef_resolve_all(c_parm_type);
|
||||
Delete(c_parm_type);
|
||||
c_parm_type = tdtype;
|
||||
}
|
||||
|
||||
// template handling
|
||||
Replaceall(c_parm_type, "$tt", SwigType_lstr(type, 0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue