Commits

Iain Buclaw  committed 00ae62a

Issue #317 - ICE: tree check: in build_function_type

  • Participants
  • Parent commits f4b81c8

Comments (0)

Files changed (12)

File d/d-codegen.h

 public:
   AggregateDeclaration * aggDecl;
   FieldVisitor(AggregateDeclaration * decl) : aggDecl(decl) { }
-  //virtual doField(VarDeclaration * field) = 0;
   virtual void doFields(VarDeclarations * fields, AggregateDeclaration * agg) = 0;
   virtual void doInterfaces(BaseClasses * bases, AggregateDeclaration * agg) = 0;
 
     g.ofile->setCfunEndLoc(endloc);
 
     AggregateDeclaration * ad = isThis();
+    // Add method to record for debug information.
+    if (ad != NULL)
+    {
+        tree rec = ad->type->toCtype();
+
+        if (ad->isClassDeclaration())
+            rec = TREE_TYPE(rec);
+
+        g.ofile->addAggMethod(rec, this);
+    }
+
     tree parm_decl = NULL_TREE;
     tree param_list = NULL_TREE;
 
 StructDeclaration::toDebug()
 {
     tree ctype = type->toCtype();
-    g.ofile->addAggMethods(ctype, this);
     g.ofile->declareType(ctype, this);
     rest_of_type_compilation(ctype, /*toplevel*/1);
 }
 void
 ClassDeclaration::toDebug()
 {
-    tree rec_type = TREE_TYPE(type->toCtype());
     /* Used to create BINFO even if debugging was off.  This was needed to keep
        references to inherited types. */
-
-    g.ofile->addAggMethods(rec_type, this);
+    tree rec_type = TREE_TYPE(type->toCtype());
 
     if (! isInterfaceDeclaration())
         TYPE_BINFO(rec_type) = binfo_for(NULL_TREE, this);

File d/d-objfile.cc

 }
 
 void
-ObjectFile::addAggMethods(tree rec_type, AggregateDeclaration * agg)
+ObjectFile::addAggMethod(tree rec_type, FuncDeclaration * fd)
 {
     if (write_symbols != NO_DEBUG)
     {
-        ListMaker methods;
-        for (size_t i = 0; i < agg->methods.dim; i++)
-        {
-            FuncDeclaration * fd = agg->methods[i];
-            methods.chain(fd->toSymbol()->Stree);
-        }
-        TYPE_METHODS(rec_type) = methods.head;
+        tree methods = TYPE_METHODS(rec_type);
+        tree t = fd->toSymbol()->Stree;
+        TYPE_METHODS(rec_type) = chainon(methods, t);
     }
 }
 

File d/d-objfile.h

   static void outputStaticSymbol(Symbol * s);
   static void outputFunction(FuncDeclaration * f);
 
-  static void addAggMethods(tree rec_type, AggregateDeclaration * agg);
+  static void addAggMethod(tree rec_type, FuncDeclaration * fd);
 
   static void initTypeDecl(tree t, Dsymbol * d_sym);
 

File d/dmd/aggregate.h

 
 #ifdef IN_GCC
     Expressions * attributes;   // GCC decl/type attributes
-    FuncDeclarations methods;   // flat list of all methods for debug information
 #endif
 
     AggregateDeclaration(Loc loc, Identifier *id);

File d/dmd/class.c

         attributes->append(sc->attributes);
     else
         attributes = sc->attributes;
-
-    methods.setDim(0);
 #endif
 
     if (sc->stc & STCdeprecated)

File d/dmd/func.c

                 v->parent = this;
                 vthis = v;
             }
-#ifdef IN_GCC
-            ad->methods.push(this);
-#endif
         }
         else if (isNested())
         {

File d/dmd/struct.c

     }
 
     unsigned dprogress_save = Module::dprogress;
-#ifdef IN_GCC
-    methods.setDim(0);
-#endif
 
     parent = sc->parent;
     type = type->semantic(loc, sc);

File d/dmd2/aggregate.h

 
 #ifdef IN_GCC
     Expressions * attributes;   // GCC decl/type attributes
-    FuncDeclarations methods;   // flat list of all methods for debug information
 #endif
 
     AggregateDeclaration(Loc loc, Identifier *id);

File d/dmd2/class.c

         attributes->append(sc->attributes);
     else
         attributes = sc->attributes;
-    methods.setDim(0);
 #endif
 
     if (sc->stc & STCdeprecated)

File d/dmd2/func.c

             }
             else
                 assert(!isNested() || sc->intypeof);    // can't be both member and nested
-#ifdef IN_GCC
-            ad->methods.push(this);
-#endif
         }
         vthis = declareThis(sc2, ad);
 

File d/dmd2/struct.c

         scx = scope;            // save so we don't make redundant copies
         scope = NULL;
     }
-#ifdef IN_GCC
-    methods.setDim(0);
-#endif
 
     unsigned dprogress_save = Module::dprogress;