Get rid of c:objstruct attribute

The only remaining use of this attribute is to test for whether we're wrapping
a ctor and it is simpler and more clear to just check the node type directly
in this case.

This attribute was pretty confusing as it was used for parameters and entire
declarations, so removing it makes things more clear and simpler.
This commit is contained in:
Vadim Zeitlin 2016-04-21 23:50:57 +02:00
commit 97fc60ef51

View file

@ -917,6 +917,7 @@ ready:
String *wname = IS_SET_TO_ONE(n, "c:globalfun") ? Swig_name_wrapper(name) : Copy(name);
ParmList *parms = Getattr(n, "parms");
Parm *p;
bool const is_ctor = Cmp(nodeType(n), "constructor") == 0;
bool is_void_return = (SwigType_type(type) == T_VOID);
bool return_object = false;
// create new function wrapper object
@ -926,7 +927,7 @@ ready:
Setattr(n, "wrap:name", wname);
// add variable for holding result of original function 'cppresult'
if (!is_void_return && !IS_SET_TO_ONE(n, "c:objstruct")) {
if (!is_void_return && !is_ctor) {
String *tm;
if ((tm = Swig_typemap_lookup("cppouttype", n, "", 0))) {
functionWrapperAddCPPResult(wrapper, type, tm);
@ -978,7 +979,6 @@ ready:
}
// handle special cases of cpp return result
bool const is_ctor = Cmp(nodeType(n), "constructor") == 0;
if (!is_ctor) {
if (SwigType_isenum(SwigType_base(type))){
if (return_object)
@ -1025,7 +1025,7 @@ ready:
action = emit_action(n);
// emit output typemap if needed
if (!is_void_return && (Cmp(Getattr(n, "c:objstruct"), "1") != 0)) {
if (!is_void_return && !is_ctor) {
String *tm;
if ((tm = Swig_typemap_lookup_out("out", n, "cppresult", wrapper, action))) {
Replaceall(tm, "$result", "result");
@ -1532,8 +1532,6 @@ ready:
Delete(arg_lnames);
Setattr(n, "c:objstruct", "1");
return is_copy_ctor ? Language::copyconstructorHandler(n) : Language::constructorHandler(n);
}