diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index af5e6430f1..4b481fcf71 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -1034,6 +1034,9 @@ implementation needs to be added implicitly } current_module.updatemaps; + { create whole program optimisation information } + current_module.wpoinfo:=tunitwpoinfo.create; + { ... parse the declarations } Message1(parser_u_parsing_interface,current_module.realmodulename^); symtablestack.push(current_module.globalsymtable); @@ -1112,9 +1115,6 @@ implementation symtablestack.push(current_module.globalsymtable); symtablestack.push(current_module.localsymtable); - { create whole program optimisation information } - current_module.wpoinfo:=tunitwpoinfo.create; - if not current_module.interface_only then begin Message1(parser_u_parsing_implementation,current_module.modulename^); diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas index 79c7ee4d99..6b689a7b96 100644 --- a/compiler/ptconst.pas +++ b/compiler/ptconst.pas @@ -44,7 +44,8 @@ implementation { parser specific stuff } pbase,pexpr,pdecvar, { codegen } - cpuinfo,cgbase,dbgbase + cpuinfo,cgbase,dbgbase, + wpobase ; {$maxfpuregisters 0} @@ -329,6 +330,11 @@ implementation if not Tobjectdef(tclassrefdef(n.resultdef).pointeddef).is_related(tobjectdef(def.pointeddef)) then IncompatibleTypes(n.resultdef, def); list.concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol(Tobjectdef(tclassrefdef(n.resultdef).pointeddef).vmt_mangledname))); + { update wpo info } + if not assigned(current_procinfo) or + (po_inline in current_procinfo.procdef.procoptions) or + wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname) then + tobjectdef(tclassrefdef(n.resultdef).pointeddef).register_maybe_created_object_type; end; niln: list.concat(Tai_const.Create_sym(nil));