mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:49:22 +02:00
* fixed handling of typed files for LLVM when ISO-like I/O is active: encode
the buffer in the type, and support typecasting the typed file to a different size (needed to be able to pass it to the compiler helpers that expected a "TypedFile", whose buffer is 0 bytes and which hence will always have a smaller size than the original type) (fixes test/tisoext1) git-svn-id: trunk@35017 -
This commit is contained in:
parent
d0b2701693
commit
ee014fa4ff
@ -113,7 +113,7 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
cutils,constexp,
|
||||
globals,cutils,constexp,
|
||||
verbose,systems,
|
||||
fmodule,
|
||||
symtable,symconst,symsym,
|
||||
@ -392,7 +392,22 @@ implementation
|
||||
case tfiledef(def).filetyp of
|
||||
ft_text :
|
||||
llvmaddencodedtype_intern(search_system_type('TEXTREC').typedef,[lef_inaggregate]+[lef_typedecl]*flags,encodedstr);
|
||||
ft_typed,
|
||||
ft_typed :
|
||||
begin
|
||||
{ in case of ISO-like I/O, the typed file def includes a
|
||||
get/put buffer of the size of the file's elements }
|
||||
if (m_isolike_io in current_settings.modeswitches) and
|
||||
not is_void(tfiledef(def).typedfiledef) then
|
||||
encodedstr:=encodedstr+'<{';
|
||||
llvmaddencodedtype_intern(search_system_type('FILEREC').typedef,[lef_inaggregate]+[lef_typedecl]*flags,encodedstr);
|
||||
if (m_isolike_io in current_settings.modeswitches) and
|
||||
not is_void(tfiledef(def).typedfiledef) then
|
||||
begin
|
||||
encodedstr:=encodedstr+',[';
|
||||
encodedstr:=encodedstr+tostr(tfiledef(def).typedfiledef.size);
|
||||
encodedstr:=encodedstr+' x i8]}>'
|
||||
end;
|
||||
end;
|
||||
ft_untyped :
|
||||
llvmaddencodedtype_intern(search_system_type('FILEREC').typedef,[lef_inaggregate]+[lef_typedecl]*flags,encodedstr);
|
||||
else
|
||||
|
@ -236,7 +236,16 @@ procedure tllvmtypeconvnode.second_nothing;
|
||||
(resultdef.typ<>formaldef) and
|
||||
not is_open_array(resultdef) and
|
||||
not is_open_array(left.resultdef) and
|
||||
(left.resultdef.size<>resultdef.size) then
|
||||
(left.resultdef.size<>resultdef.size) and
|
||||
{ in case of ISO-like I/O, the typed file def includes a
|
||||
get/put buffer of the size of the file's elements }
|
||||
not(
|
||||
(m_isolike_io in current_settings.modeswitches) and
|
||||
(left.resultdef.typ=filedef) and
|
||||
(tfiledef(left.resultdef).filetyp=ft_typed) and
|
||||
(resultdef.typ=filedef) and
|
||||
(tfiledef(resultdef).filetyp=ft_untyped)
|
||||
) then
|
||||
internalerror(2014012216);
|
||||
hlcg.location_force_mem(current_asmdata.CurrAsmList,left.location,left.resultdef);
|
||||
hreg:=hlcg.getaddressregister(current_asmdata.CurrAsmList,cpointerdef.getreusable(resultdef));
|
||||
|
Loading…
Reference in New Issue
Block a user