Fixed a bug where assignment helpers may not be generated for classes that have 4.9-maint 4.9.3
authorphil
Mon Nov 23 13:48:46 2009 +0000 (2009-11-23)
branch4.9-maint
changeset 590e45c8055ee07
parent 589 a58688714613
Fixed a bug where assignment helpers may not be generated for classes that have
an alternate mapped type implementation.
Released as v4.9.3.
NEWS
sipgen/transform.c
     1.1 --- a/NEWS	Thu Nov 19 17:35:52 2009 +0000
     1.2 +++ b/NEWS	Mon Nov 23 13:48:46 2009 +0000
     1.3 @@ -1,3 +1,6 @@
     1.4 +v4.9.3 23rd November 2009
     1.5 +  - A bug fix release.
     1.6 +
     1.7  v4.9.2 20th November 2009
     1.8    - A bug fix release.
     1.9  
     2.1 --- a/sipgen/transform.c	Thu Nov 19 17:35:52 2009 +0000
     2.2 +++ b/sipgen/transform.c	Mon Nov 23 13:48:46 2009 +0000
     2.3 @@ -68,7 +68,7 @@
     2.4  static mappedTypeDef *instantiateMappedTypeTemplate(sipSpec *pt, moduleDef *mod, mappedTypeTmplDef *mtt, argDef *type);
     2.5  static classDef *getProxy(moduleDef *mod, classDef *cd);
     2.6  static int generatingCodeForModule(sipSpec *pt, moduleDef *mod);
     2.7 -static void checkAssignmentHelper(classDef *cd);
     2.8 +static void checkAssignmentHelper(sipSpec *pt, classDef *cd);
     2.9  static void addComplementarySlots(sipSpec *pt, classDef *cd);
    2.10  static void addComplementarySlot(sipSpec *pt, classDef *cd, memberDef *md,
    2.11          slotType cslot, const char *cslot_name);
    2.12 @@ -269,7 +269,7 @@
    2.13  
    2.14      /* Mark classes that can have an assignment helper. */
    2.15      for (cd = pt->classes; cd != NULL; cd = cd->next)
    2.16 -        checkAssignmentHelper(cd);
    2.17 +        checkAssignmentHelper(pt, cd);
    2.18  
    2.19      setStringPoolOffsets(pt);
    2.20  }
    2.21 @@ -474,7 +474,7 @@
    2.22  /*
    2.23   * See if a class supports an assignment helper.
    2.24   */
    2.25 -static void checkAssignmentHelper(classDef *cd)
    2.26 +static void checkAssignmentHelper(sipSpec *pt, classDef *cd)
    2.27  {
    2.28      int pub_def_ctor, pub_copy_ctor;
    2.29      ctorDef *ct;
    2.30 @@ -505,9 +505,17 @@
    2.31          else if (ct->cppsig->nrArgs == 1)
    2.32          {
    2.33              argDef *ad = &ct->cppsig->args[0];
    2.34 -
    2.35 -            if (ad->atype == class_type && ad->u.cd == cd && isReference(ad) &&
    2.36 -                isConstArg(ad) && ad->nrderefs == 0 && ad->defval == NULL)
    2.37 +            classDef *arg_cd;
    2.38 +
    2.39 +            if (ad->atype == class_type)
    2.40 +                arg_cd = ad->u.cd;
    2.41 +            else if (ad->atype == mapped_type)
    2.42 +                arg_cd = findAltClassImplementation(pt, ad->u.mtd);
    2.43 +            else
    2.44 +                arg_cd = NULL;
    2.45 +
    2.46 +            if (arg_cd == cd && isReference(ad) && isConstArg(ad) &&
    2.47 +                ad->nrderefs == 0 && ad->defval == NULL)
    2.48                  pub_copy_ctor = TRUE;
    2.49          }
    2.50      }