Przeglądaj źródła

+ extend ttypesym with the possiblity to create it as unregistered
* for now all typesyms are created as registered
Note: an additional parameter instead of an overload is used for ttypesym.create as otherwise both constructors would need to be overridden in potential descendant CPU-specific classes...

git-svn-id: trunk@31591 -

svenbarth 10 lat temu
rodzic
commit
d45c275ef3

+ 1 - 1
compiler/blockutl.pas

@@ -227,7 +227,7 @@ implementation
         begin
         begin
           { alias for the type to invoke the procvar, used in the symcreat
           { alias for the type to invoke the procvar, used in the symcreat
             handling of tsk_block_invoke_procvar }
             handling of tsk_block_invoke_procvar }
-          result.localst.insert(ctypesym.create('__FPC_BLOCK_INVOKE_PV_TYPE',orgpv));
+          result.localst.insert(ctypesym.create('__FPC_BLOCK_INVOKE_PV_TYPE',orgpv,true));
           result.synthetickind:=tsk_block_invoke_procvar;
           result.synthetickind:=tsk_block_invoke_procvar;
         end;
         end;
     end;
     end;

+ 2 - 2
compiler/pdecl.pas

@@ -592,7 +592,7 @@ implementation
                   sym:=tsym(symtablestack.top.Find(typename));
                   sym:=tsym(symtablestack.top.Find(typename));
                   if not assigned(sym) then
                   if not assigned(sym) then
                     begin
                     begin
-                      sym:=ctypesym.create(orgtypename,cundefineddef.create);
+                      sym:=ctypesym.create(orgtypename,cundefineddef.create,true);
                       Include(sym.symoptions,sp_generic_dummy);
                       Include(sym.symoptions,sp_generic_dummy);
                       ttypesym(sym).typedef.typesym:=sym;
                       ttypesym(sym).typedef.typesym:=sym;
                       sym.visibility:=symtablestack.top.currentvisibility;
                       sym.visibility:=symtablestack.top.currentvisibility;
@@ -628,7 +628,7 @@ implementation
               { insert a new type if we don't reuse an existing symbol }
               { insert a new type if we don't reuse an existing symbol }
               if not assigned(newtype) then
               if not assigned(newtype) then
                 begin
                 begin
-                  newtype:=ctypesym.create(genorgtypename,hdef);
+                  newtype:=ctypesym.create(genorgtypename,hdef,true);
                   newtype.visibility:=symtablestack.top.currentvisibility;
                   newtype.visibility:=symtablestack.top.currentvisibility;
                   symtablestack.top.insert(newtype);
                   symtablestack.top.insert(newtype);
                 end;
                 end;

+ 1 - 1
compiler/pdecsub.pas

@@ -368,7 +368,7 @@ implementation
              { possible proc directives }
              { possible proc directives }
              if check_proc_directive(true) then
              if check_proc_directive(true) then
                begin
                begin
-                  dummytype:=ctypesym.create('unnamed',hdef);
+                  dummytype:=ctypesym.create('unnamed',hdef,true);
                   parse_var_proc_directives(tsym(dummytype));
                   parse_var_proc_directives(tsym(dummytype));
                   dummytype.typedef:=nil;
                   dummytype.typedef:=nil;
                   hdef.typesym:=nil;
                   hdef.typesym:=nil;

+ 1 - 1
compiler/pdecvar.pas

@@ -841,7 +841,7 @@ implementation
             (def.typesym=nil) and
             (def.typesym=nil) and
             check_proc_directive(true) then
             check_proc_directive(true) then
            begin
            begin
-              newtype:=ctypesym.create('unnamed',def);
+              newtype:=ctypesym.create('unnamed',def,true);
               parse_var_proc_directives(tsym(newtype));
               parse_var_proc_directives(tsym(newtype));
               newtype.typedef:=nil;
               newtype.typedef:=nil;
               def.typesym:=nil;
               def.typesym:=nil;

+ 4 - 4
compiler/pgenutil.pas

@@ -841,7 +841,7 @@ uses
 
 
                 { First a new typesym so we can reuse this specialization and
                 { First a new typesym so we can reuse this specialization and
                   references to this specialization can be handled }
                   references to this specialization can be handled }
-                srsym:=ctypesym.create(finalspecializename,generrordef);
+                srsym:=ctypesym.create(finalspecializename,generrordef,true);
                 specializest.insert(srsym);
                 specializest.insert(srsym);
 
 
                 { specializations are declarations as such it is the wisest to
                 { specializations are declarations as such it is the wisest to
@@ -1033,7 +1033,7 @@ uses
         repeat
         repeat
           if token=_ID then
           if token=_ID then
             begin
             begin
-              generictype:=ctypesym.create(orgpattern,cundefinedtype);
+              generictype:=ctypesym.create(orgpattern,cundefinedtype,true);
               { type parameters need to be added as strict private }
               { type parameters need to be added as strict private }
               generictype.visibility:=vis_strictprivate;
               generictype.visibility:=vis_strictprivate;
               include(generictype.symoptions,sp_generic_para);
               include(generictype.symoptions,sp_generic_para);
@@ -1230,7 +1230,7 @@ uses
             generictype:=ttypesym(genericlist[i]);
             generictype:=ttypesym(genericlist[i]);
             if assigned(generictype.owner) then
             if assigned(generictype.owner) then
               begin
               begin
-                sym:=ctypesym.create(genericlist.nameofindex(i),generictype.typedef);
+                sym:=ctypesym.create(genericlist.nameofindex(i),generictype.typedef,true);
                 { type parameters need to be added as strict private }
                 { type parameters need to be added as strict private }
                 sym.visibility:=vis_strictprivate;
                 sym.visibility:=vis_strictprivate;
                 st.insert(sym);
                 st.insert(sym);
@@ -1277,7 +1277,7 @@ uses
           begin
           begin
             { we need to pass nil as def here, because the constructor wants
             { we need to pass nil as def here, because the constructor wants
               to set the typesym of the def which is not what we want }
               to set the typesym of the def which is not what we want }
-            gensym:=ctypesym.create(copy(name,1,pos('$',name)-1),nil);
+            gensym:=ctypesym.create(copy(name,1,pos('$',name)-1),nil,true);
             gensym.typedef:=current_structdef;
             gensym.typedef:=current_structdef;
             include(gensym.symoptions,sp_internal);
             include(gensym.symoptions,sp_internal);
             { the symbol should be only visible to the generic class
             { the symbol should be only visible to the generic class

+ 1 - 1
compiler/pmodules.pas

@@ -723,7 +723,7 @@ implementation
           include(def.objectoptions,oo_is_external);
           include(def.objectoptions,oo_is_external);
           include(def.objectoptions,oo_is_sealed);
           include(def.objectoptions,oo_is_sealed);
           def.objextname:=stringdup(current_module.realmodulename^);
           def.objextname:=stringdup(current_module.realmodulename^);
-          typesym:=ctypesym.create('__FPC_JVM_Module_Class_Alias$',def);
+          typesym:=ctypesym.create('__FPC_JVM_Module_Class_Alias$',def,true);
           symtablestack.top.insert(typesym);
           symtablestack.top.insert(typesym);
         end;
         end;
 {$endif jvm}
 {$endif jvm}

+ 2 - 2
compiler/psystem.pas

@@ -172,7 +172,7 @@ implementation
 
 
         function addtype(const s:string;def:tdef):ttypesym;
         function addtype(const s:string;def:tdef):ttypesym;
         begin
         begin
-          result:=ctypesym.create(s,def);
+          result:=ctypesym.create(s,def,true);
           systemunit.insert(result);
           systemunit.insert(result);
         end;
         end;
 
 
@@ -480,7 +480,7 @@ implementation
             { can't use addtype for pvmt because the rtti of the pointed
             { can't use addtype for pvmt because the rtti of the pointed
               type is not available. The rtti for pvmt will be written implicitly
               type is not available. The rtti for pvmt will be written implicitly
               by thev tblarray below }
               by thev tblarray below }
-            systemunit.insert(ctypesym.create('$pvmt',pvmttype));
+            systemunit.insert(ctypesym.create('$pvmt',pvmttype,true));
             addfield(hrecst,cfieldvarsym.create('$length',vs_value,ptrsinttype,[]));
             addfield(hrecst,cfieldvarsym.create('$length',vs_value,ptrsinttype,[]));
             addfield(hrecst,cfieldvarsym.create('$mlength',vs_value,ptrsinttype,[]));
             addfield(hrecst,cfieldvarsym.create('$mlength',vs_value,ptrsinttype,[]));
             addfield(hrecst,cfieldvarsym.create('$parent',vs_value,pvmttype,[]));
             addfield(hrecst,cfieldvarsym.create('$parent',vs_value,pvmttype,[]));

+ 1 - 1
compiler/ptype.pas

@@ -1494,7 +1494,7 @@ implementation
               begin
               begin
                 if check_proc_directive(true) then
                 if check_proc_directive(true) then
                   begin
                   begin
-                    newtype:=ctypesym.create('unnamed',result);
+                    newtype:=ctypesym.create('unnamed',result,true);
                     parse_var_proc_directives(tsym(newtype));
                     parse_var_proc_directives(tsym(newtype));
                     newtype.typedef:=nil;
                     newtype.typedef:=nil;
                     result.typesym:=nil;
                     result.typesym:=nil;

+ 1 - 1
compiler/symcreat.pas

@@ -1270,7 +1270,7 @@ implementation
          (def.typ=recorddef) and
          (def.typ=recorddef) and
          not assigned(def.typesym) then
          not assigned(def.typesym) then
         begin
         begin
-          ts:=ctypesym.create(trecorddef(def).symtable.realname^,def);
+          ts:=ctypesym.create(trecorddef(def).symtable.realname^,def,true);
           st.insert(ts);
           st.insert(ts);
           ts.visibility:=vis_strictprivate;
           ts.visibility:=vis_strictprivate;
           { this typesym can't be used by any Pascal code, so make sure we don't
           { this typesym can't be used by any Pascal code, so make sure we don't

+ 1 - 1
compiler/symdef.pas

@@ -4137,7 +4137,7 @@ implementation
         ts:=nil;
         ts:=nil;
         if definedname then
         if definedname then
           begin
           begin
-            ts:=ctypesym.create(n,self);
+            ts:=ctypesym.create(n,self,true);
             { avoid hints about unused types (these may only be used for
             { avoid hints about unused types (these may only be used for
               typed constant data) }
               typed constant data) }
             ts.increfcount;
             ts.increfcount;

+ 3 - 3
compiler/symsym.pas

@@ -157,7 +157,7 @@ interface
           typedef      : tdef;
           typedef      : tdef;
           typedefderef : tderef;
           typedefderef : tderef;
           fprettyname : ansistring;
           fprettyname : ansistring;
-          constructor create(const n : string;def:tdef);virtual;
+          constructor create(const n : string;def:tdef;doregister:boolean);virtual;
           destructor destroy;override;
           destructor destroy;override;
           constructor ppuload(ppufile:tcompilerppufile);
           constructor ppuload(ppufile:tcompilerppufile);
           { do not override this routine in platform-specific subclasses,
           { do not override this routine in platform-specific subclasses,
@@ -2598,10 +2598,10 @@ implementation
 ****************************************************************************}
 ****************************************************************************}
 
 
 
 
-    constructor ttypesym.create(const n : string;def:tdef);
+    constructor ttypesym.create(const n : string;def:tdef;doregister:boolean);
 
 
       begin
       begin
-        inherited create(typesym,n,true);
+        inherited create(typesym,n,doregister);
         typedef:=def;
         typedef:=def;
         { register the typesym for the definition }
         { register the typesym for the definition }
         if assigned(typedef) and
         if assigned(typedef) and