Fix for exception specifications that are references. Also improves the generated

exception declarations in the catch handler for pointers - a pointer is used
instead of a reference to a pointer.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5940 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-05-29 15:03:46 +00:00
commit 4c472ec20e

View file

@ -405,7 +405,7 @@ void emit_action(Node *n, Wrapper *f) {
/* saves action -> eaction for postcatching exception */
String *eaction = NewString("");
/* If we are in C++ mode and there is a throw specifier. We're going to
/* If we are in C++ mode and there is an exception specification. We're going to
enclose the block in a try block */
if (throws) {
Printf(eaction,"try {\n");
@ -419,7 +419,13 @@ void emit_action(Node *n, Wrapper *f) {
for (Parm *ep = throws; ep; ep = nextSibling(ep)) {
String *em = Swig_typemap_lookup_new("throws",ep,"_e",0);
if (em) {
Printf(eaction,"catch(%s) {\n", SwigType_str(Getattr(ep,"type"),"&_e"));
SwigType *et = Getattr(ep,"type");
SwigType *etr = SwigType_typedef_resolve_all(et);
if (SwigType_isreference(etr) || SwigType_ispointer(etr)) {
Printf(eaction,"catch(%s) {\n", SwigType_str(et, "_e"));
} else {
Printf(eaction,"catch(%s) {\n", SwigType_str(et, "&_e"));
}
Printv(eaction,em,"\n",NIL);
Printf(eaction,"}\n");
} else {