Ensure that no garbage for specialization code is written in case of "-al"

assemble.pas, TExternalAssembler.WriteSourceLine:
  * also respect a module change which can happen if the generated assembler code belongs to a specialized generic

git-svn-id: trunk@23628 -
This commit is contained in:
svenbarth 2013-02-18 16:53:37 +00:00
parent 30247d8961
commit b219638284

View File

@ -704,11 +704,21 @@ Implementation
end;
procedure TExternalAssembler.WriteSourceLine(hp: tailineinfo);
var
module : tmodule;
begin
{ load infile }
if lastfileinfo.fileindex<>hp.fileinfo.fileindex then
if (lastfileinfo.moduleindex<>hp.fileinfo.moduleindex) or
(lastfileinfo.fileindex<>hp.fileinfo.fileindex) then
begin
infile:=current_module.sourcefiles.get_file(hp.fileinfo.fileindex);
{ in case of a generic the module can be different }
if current_module.unit_index=hp.fileinfo.moduleindex then
module:=current_module
else
module:=get_module(hp.fileinfo.moduleindex);
if not assigned(module) then
internalerror(2013021801);
infile:=module.sourcefiles.get_file(hp.fileinfo.fileindex);
if assigned(infile) then
begin
{ open only if needed !! }
@ -717,6 +727,7 @@ Implementation
end;
{ avoid unnecessary reopens of the same file !! }
lastfileinfo.fileindex:=hp.fileinfo.fileindex;
lastfileinfo.moduleindex:=hp.fileinfo.moduleindex;
{ be sure to change line !! }
lastfileinfo.line:=-1;
end;