Fix some subtle named output typemap lookup misses, the fully qualified name was not always being in all cases such as member variables
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13878 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0ca11c8b6f
commit
421139a5fe
7 changed files with 62 additions and 13 deletions
|
|
@ -8,6 +8,27 @@ Version 2.0.9 (in progress)
|
|||
2012-11-09: vzeitlin
|
||||
[Python] Fix overflow when passing values greater than LONG_MAX from Python 3 for parameters with unsigned long C type.
|
||||
|
||||
2012-11-02: wsfulton
|
||||
Fix some subtle named output typemap lookup misses, the fully qualified name was not always being
|
||||
used for variables, for example:
|
||||
|
||||
struct Glob {
|
||||
int MyVar;
|
||||
};
|
||||
|
||||
Previously the search rules (as shown by -debug-tmsearch) for the getter wrapper were:
|
||||
|
||||
example.i:44: Searching for a suitable 'out' typemap for: int MyVar
|
||||
Looking for: int MyVar
|
||||
Looking for: int
|
||||
|
||||
Now the scope is named correctly:
|
||||
|
||||
example.i:44: Searching for a suitable 'out' typemap for: int Glob::MyVar
|
||||
Looking for: int Glob::MyVar
|
||||
Looking for: int MyVar
|
||||
Looking for: int
|
||||
|
||||
2012-10-26: wsfulton
|
||||
Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously
|
||||
the name was ignored during the typemap search. Applies to the following list of typemaps:
|
||||
|
|
|
|||
|
|
@ -3514,7 +3514,6 @@ public:
|
|||
* --------------------------------------------------------------- */
|
||||
|
||||
int classDirectorMethod(Node *n, Node *parent, String *super) {
|
||||
String *empty_str = NewString("");
|
||||
String *classname = Getattr(parent, "sym:name");
|
||||
String *c_classname = Getattr(parent, "name");
|
||||
String *name = Getattr(n, "name");
|
||||
|
|
@ -3625,8 +3624,7 @@ public:
|
|||
String *cdesc = NULL;
|
||||
SwigType *covariant = Getattr(n, "covariant");
|
||||
SwigType *adjustedreturntype = covariant ? covariant : returntype;
|
||||
Parm *adjustedreturntypeparm = NewParm(adjustedreturntype, name, n);
|
||||
// Setattr(adjustedreturntypeparm, "sym:symtab", Getattr(n, "sym:symtab"));
|
||||
Parm *adjustedreturntypeparm = NewParmNode(adjustedreturntype, n);
|
||||
|
||||
if ((tm = Swig_typemap_lookup("directorin", adjustedreturntypeparm, "", 0))
|
||||
&& (cdesc = Getattr(adjustedreturntypeparm, "tmap:directorin:descriptor"))) {
|
||||
|
|
@ -3646,7 +3644,7 @@ public:
|
|||
/* Get the JNI field descriptor for this return type, add the JNI field descriptor
|
||||
to jniret_desc */
|
||||
if ((c_ret_type = Swig_typemap_lookup("jni", n, "", 0))) {
|
||||
Parm *tp = NewParm(c_ret_type, name, n);
|
||||
Parm *tp = NewParmNode(c_ret_type, n);
|
||||
|
||||
if (!is_void && !ignored_method) {
|
||||
String *jretval_decl = NewStringf("%s jresult", c_ret_type);
|
||||
|
|
@ -3737,7 +3735,7 @@ public:
|
|||
}
|
||||
|
||||
/* Start the Java field descriptor for the intermediate class's upcall (insert self object) */
|
||||
Parm *tp = NewParm(c_classname, empty_str, n);
|
||||
Parm *tp = NewParmNode(c_classname, n);
|
||||
String *jdesc;
|
||||
|
||||
if ((tm = Swig_typemap_lookup("directorin", tp, "", 0))
|
||||
|
|
@ -3779,7 +3777,7 @@ public:
|
|||
|
||||
/* Get parameter's intermediary C type */
|
||||
if ((c_param_type = Getattr(p, "tmap:jni"))) {
|
||||
Parm *tp = NewParm(c_param_type, empty_str, n);
|
||||
Parm *tp = NewParm(c_param_type, Getattr(p, "name"), n);
|
||||
String *desc_tm = NULL, *jdesc = NULL, *cdesc = NULL;
|
||||
|
||||
/* Add to local variables */
|
||||
|
|
|
|||
|
|
@ -1419,7 +1419,12 @@ int Language::membervariableHandler(Node *n) {
|
|||
target = NewStringf("%s->%s", pname, name);
|
||||
Delete(pname);
|
||||
}
|
||||
tm = Swig_typemap_lookup("memberin", n, target, 0);
|
||||
|
||||
// This is an input type typemap lookup and so it should not use Node n
|
||||
// otherwise qualification is done on the parameter name for the setter function
|
||||
Parm *nin = NewParm(type, name, n);
|
||||
tm = Swig_typemap_lookup("memberin", nin, target, 0);
|
||||
Delete(nin);
|
||||
}
|
||||
int flags = Extend | SmartPointer | use_naturalvar_mode(n);
|
||||
if (isNonVirtualProtectedAccess(n))
|
||||
|
|
|
|||
|
|
@ -682,7 +682,7 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
|
|||
XXX Have to be a little more clever so that we can deal with struct A * - the * is getting lost.
|
||||
Is this still true? If so, will a SwigType_push() solve things?
|
||||
*/
|
||||
Parm *bbase = NewParm(rettype, Swig_cresult_name(), n);
|
||||
Parm *bbase = NewParmNode(rettype, n);
|
||||
String *returnTM = Swig_typemap_lookup("in", bbase, Swig_cresult_name(), f);
|
||||
if(returnTM) {
|
||||
String *tm = returnTM;
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ char cvsroot_parms_c[] = "$Id$";
|
|||
* NewParm()
|
||||
*
|
||||
* Create a new parameter from datatype 'type' and name 'name' copying
|
||||
* the file and line number from the Node file_line_node.
|
||||
* the file and line number from the Node from_node.
|
||||
* ------------------------------------------------------------------------ */
|
||||
|
||||
Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *file_line_node) {
|
||||
Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *from_node) {
|
||||
Parm *p = NewParmWithoutFileLineInfo(type, name);
|
||||
Setfile(p, Getfile(file_line_node));
|
||||
Setline(p, Getline(file_line_node));
|
||||
Setfile(p, Getfile(from_node));
|
||||
Setline(p, Getline(from_node));
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
@ -48,6 +48,20 @@ Parm *NewParmWithoutFileLineInfo(SwigType *type, const_String_or_char_ptr name)
|
|||
return p;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
* NewParmNode()
|
||||
*
|
||||
* Create a new parameter from datatype 'type' and name and symbol table as
|
||||
* well as file and line number from the 'from_node'.
|
||||
* The resulting Parm will be similar to a Node used for typemap lookups.
|
||||
* ------------------------------------------------------------------------ */
|
||||
|
||||
Parm *NewParmNode(SwigType *type, Node *from_node) {
|
||||
Parm *p = NewParm(type, Getattr(from_node, "name"), from_node);
|
||||
Setattr(p, "sym:symtab", Getattr(from_node, "sym:symtab"));
|
||||
return p;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
* CopyParm()
|
||||
* ------------------------------------------------------------------------ */
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Individual parameters */
|
||||
extern Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *file_line_node);
|
||||
extern Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *from_node);
|
||||
extern Parm *NewParmWithoutFileLineInfo(SwigType *type, const_String_or_char_ptr name);
|
||||
extern Parm *NewParmNode(SwigType *type, Node *from_node);
|
||||
extern Parm *CopyParm(Parm *p);
|
||||
|
||||
/* Parameter lists */
|
||||
|
|
|
|||
|
|
@ -1339,7 +1339,17 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, No
|
|||
|
||||
pname = Getattr(node, "name");
|
||||
|
||||
/*
|
||||
if (pname && node && Getattr(node, "sym:symtab")) {
|
||||
if (!checkAttribute(node, "kind", "function")) {
|
||||
Printf(stdout, "New check: %s %s %s\n", Getattr(node, "name"), nodeType(node), Getattr(node, "kind"));
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (pname && node && Getattr(node, "sym:symtab")) {
|
||||
/*
|
||||
if (pname && node && checkAttribute(node, "kind", "function")) {
|
||||
*/
|
||||
/*
|
||||
For functions, add on a qualified name search, for example
|
||||
struct Foo {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue