Commit Graph

585 Commits

Author SHA1 Message Date
Sven Barth
6279283ce1 * fix for #39310 by fixing various small issues in tabstractrecordsymtable.has_single_field:
- initialize the returned def to a safe default
  - correctly reset the found symbol for each loop
  - reset the result when descending into a record
+ added test

(cherry picked from commit efd0c250df)
2022-01-30 22:42:10 +01:00
svenbarth
66fa732720 Merged revision(s) 47634, 47655 from trunk:
* fix for Mantis #38145: allow overloading of assignment operators that return ShortStrings with a specific size
+ added tests

The following rules for using these operator overloads as *implicit* overloads apply (Delphi compatible):
  - if a found assignment operator returns a default ShortString then that is used
  - if only one assignment operator to a String[x] is found then that is used
  - otherwise the assignment is not possible
The explicit assignment checks for an exact match (and falls back for an implicit assignment). This is not entirely Delphi compatible as Delphi seems to favor the first found symbol in that case, but sometimes also not... :/
........
* with the recent ShortString changes this test is no longer needed as it was added exactly to check the condition I removed, so disable it for 3.2.1 and newer (as I want to merge these changes back to fixes)
........

git-svn-id: branches/fixes_3_2@49055 -
2021-03-26 06:18:40 +00:00
marco
775567e8f7 # revisions: 44598,45635,45757,45764,45772
git-svn-id: branches/fixes_3_2@45849 -
2020-07-24 21:09:00 +00:00
marco
fdb477df1e # revisions: 43566,43567,43568,43586,43629,43823
git-svn-id: branches/fixes_3_2@43941 -
2020-01-14 10:41:39 +00:00
Jonas Maebe
f29598384b * Objective-Pascal inferred result type and improved category method searching
--- Merging r42815 through r42817 into '.':
U    tests/test/tobjc34.pp
U    tests/test/tobjc36.pp
U    tests/test/tobjcl2.pp
A    tests/test/units/cocoaall
A    tests/test/units/cocoaall/tw35994.pp
U    compiler/defcmp.pas
U    compiler/ncal.pas
C    compiler/pdecl.pas
C    compiler/symconst.pas
C    compiler/utils/ppuutils/ppudump.pp
U    compiler/symtable.pas
--- Recording mergeinfo for merge of r42815 through r42817 into '.':
 U   .
--- Merging r42857 into '.':
G    compiler/symtable.pas
--- Recording mergeinfo for merge of r42857 into '.':
 G   .
  

git-svn-id: branches/fixes_3_2@42883 -
2019-08-31 11:43:41 +00:00
pierre
663c97ed23 Merge of revisions 41425 from trunk to fixes_3_2
------------------------------------------------------------------------
r41425 | pierre | 2019-02-23 23:03:29 +0000 (Sat, 23 Feb 2019) | 11 lines

  + compiler/symdef.pas: Add missing call to tderef.reset methods in all tdef constructors.
  + compiler/sysmsym.pas: Do the same for for all tsym constructors.
  + compiler/symtype.pas: Generate internalerror in  tcompilerppufile.putderef
    if a deref field has index -1, as this means that buildderef was not called
    while it should have been called.
  + compiler/symtable.pas: Fix bug report itself by adding an extra local variable
    CHANGED to add extra cycles in tstoredsymtable.buildderef_referenced method.

New tests for this bug report: tests/webtbs/tw35139.pp and  tests/webtbs/tw35139a.pp


------------------------------------------------------------------------
--- Merging r41425 into '.':
U    compiler/symtype.pas
U    compiler/symdef.pas
U    compiler/symsym.pas
U    compiler/symtable.pas
A    tests/webtbs/tw35139.pp
A    tests/webtbs/tw35139a.pp
--- Recording mergeinfo for merge of r41425 into '.':
 U   .

git-svn-id: branches/fixes_3_2@41620 -
2019-03-06 13:51:14 +00:00
marco
2b01261f36 --- Recording mergeinfo for merge of r39673 into '.':
U   .
--- Merging r39693 into '.':
A    tests/tbs/tb0650.pp
U    compiler/symtable.pas
--- Recording mergeinfo for merge of r39693 into '.':
 U   .
--- Merging r39700 into '.':
U    compiler/msg/errore.msg
--- Recording mergeinfo for merge of r39700 into '.':
 G   .
--- Merging r39701 into '.':
U    compiler/msgtxt.inc
U    compiler/msgidx.inc
--- Recording mergeinfo for merge of r39701 into '.':
 G   .
--- Merging r39702 into '.':
U    compiler/pdecsub.pas
A    tests/test/tgeneric105.pp
--- Recording mergeinfo for merge of r39702 into '.':
 G   .
--- Merging r39703 into '.':
A    tests/test/tgenfunc18.pp
A    tests/test/tgenfunc17.pp
G    compiler/pdecsub.pas
--- Recording mergeinfo for merge of r39703 into '.':
 G   .
--- Merging r39715 into '.':
U    packages/rtl-extra/src/inc/objects.pp
A    tests/webtbs/tw34239.pp
--- Recording mergeinfo for merge of r39715 into '.':
 G   .
--- Merging r39727 into '.':
G    packages/rtl-extra/src/inc/objects.pp
--- Recording mergeinfo for merge of r39727 into '.':
 G   .

# revisions: 39673,39693,39700,39701,39702,39703,39715,39727

git-svn-id: branches/fixes_3_2@39834 -
2018-09-27 12:36:19 +00:00
marco
ee7090b118 --- Merging r39711 into '.':
U    compiler/symtable.pas
--- Recording mergeinfo for merge of r39711 into '.':
 U   .
--- Merging r39728 into '.':
G    compiler/symtable.pas
--- Recording mergeinfo for merge of r39728 into '.':
 G   .
--- Merging r39692 into '.':
U    compiler/psub.pas
A    tests/test/tgeneric104.pp
A    tests/test/ugeneric104.pp
--- Recording mergeinfo for merge of r39692 into '.':
 G   .
--- Merging r39699 into '.':
U    packages/libffi/src/ffi.manager.pp
--- Recording mergeinfo for merge of r39699 into '.':
 G   .

# revisions: 39711,39728,39692,39699

git-svn-id: branches/fixes_3_2@39810 -
2018-09-26 13:22:48 +00:00
marco
edf32cd5dc The Important Ones:
- 39683, 39684, 39685, 39686 (rework of Interface Method RTTI)
- 39687, 39688, 39689, 39690, 39709, 39710 (change of PPU version)

git-svn-id: branches/fixes_3_2@39809 -
2018-09-26 12:50:46 +00:00
florian
68eb921d46 * broken compilation after r39347 fixed
git-svn-id: trunk@39349 -
2018-06-30 12:30:25 +00:00
svenbarth
cc153176f3 + add a new symtable option sto_has_non_trivial_init that is true if the symtable contains a symbol with an
Initialize() operator (like sto_needs_init_final this flag is calculated on demand)
* increase PPU version

git-svn-id: trunk@39252 -
2018-06-20 19:00:08 +00:00
svenbarth
80ed66f349 * move calculation of sto_needs_init_final to a separate method do_init_final_check()
git-svn-id: trunk@39251 -
2018-06-20 19:00:05 +00:00
Jonas Maebe
cb7730a423 * fixed execution order of implicit finalization and class destructors: first
the latter, then the former

git-svn-id: trunk@38716 -
2018-04-08 15:41:00 +00:00
svenbarth
b322339758 + extend tstoredsymtable with method register_children to register all its symbols and defs
git-svn-id: trunk@37339 -
2017-09-27 20:27:05 +00:00
svenbarth
83e4585b0f * correctly handle unit identifiers inside specializations of generic routines
git-svn-id: trunk@37080 -
2017-08-29 18:29:10 +00:00
svenbarth
236a9b0aa5 * rework the checks for a helper's extended def to be a class so that it can be more easily extended by other objecttypes
git-svn-id: trunk@37022 -
2017-08-21 20:48:02 +00:00
maciej-izak
751bde9792 Revert revision 36436 from trunk. Final fix for issue #31675.
git-svn-id: trunk@36446 -
2017-06-07 21:06:54 +00:00
maciej-izak
d3d29fa84c Revert revisions 36133, 36128 from trunk.
git-svn-id: trunk@36436 -
2017-06-06 07:12:26 +00:00
maciej-izak
631d4a2d53 * Move global variable in_preproc_comp_expr into tscannerfile class.
git-svn-id: trunk@36133 -
2017-05-06 12:12:50 +00:00
maciej-izak
6d1ad52dc5 * for symbols used in preprocessor expressions, we don't want to increase references count (for smaller final binaries). Partial fix for problem presented in mantis 31675. Preprocessor functions like declared() in uses section will work only for symbols declared in implicytly included modules (for example like for heaptrc by option -gh, see example/test tw31675.pp)
+ added tests

git-svn-id: trunk@36128 -
2017-05-05 22:27:07 +00:00
florian
0897bd154a + align(<int64>,<int64>) and align(<qword>,<qword>), resolves an issue reported on the mailing list with large records
+ tests
* trecordsymtable.insertunionst takes a asizeint parameter
* changed one aint into a asizeint

git-svn-id: trunk@35662 -
2017-03-26 09:35:56 +00:00
svenbarth
7dc4f16db3 * fix for Mantis #31431: allow specializations to allow private/protected variables that their generic could have accessed
git-svn-id: trunk@35510 -
2017-03-03 21:45:29 +00:00
maciej-izak
25db29d0a6 * symtable.pas:
+ search_management_operator function to find Tprocdef for selected management operator in record definition

tokens.pas:
  + new constants: first_managment_operator and last_managment_operator used in search_management_operator

git-svn-id: trunk@35444 -
2017-02-18 19:27:53 +00:00
maciej-izak
15ba9b54c6 Store informations about management operators in ppu files for records.
ppu.pas:
  * increase ppu version

symconst.pas:
  + new enum tmanagementoperator and set tmanagementoperators

symtable.pas, trecordsymtable:
  + new field managementoperators
  + new method includemanagementoperator

symdef.pas, trecorddef.ppuload and trecorddef.ppuwrite:
  * save/load for managementoperators

git-svn-id: trunk@35439 -
2017-02-18 18:43:25 +00:00
maciej-izak
48b149acd4 New tokens for new management operators: Initialize, Finalize, AddRef and Copy. Small code adjustment for parser (pdecobj.pas, pstatmnt.pas, psub.pas, ptype.pas) was required because few of old token has from now value which is outside range of set: _CONSTRUCTOR, _FINALIZATION.
New tokens for operators:
  * _OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF, _OP_COPY

New tokens:
  * _INITIALIZE, _FINALIZE, _ADDREF, _COPY

git-svn-id: trunk@35438 -
2017-02-18 18:12:45 +00:00
svenbarth
969e19ba1a * initialize module id of a symtable always to the id of the current module (at least if there is a current module, which is not the case for the initial macro symtable)
git-svn-id: trunk@35334 -
2017-01-27 13:48:05 +00:00
svenbarth
d9ea6aae4d * fix for Mantis #30761: always return the symbol found in the helper instead of doing this dependant on the presence of the overload attribute; for this the collection of all suitable overloads is done in tcallcandidates instead.
+ added test

git-svn-id: trunk@35024 -
2016-11-30 17:52:25 +00:00
svenbarth
d4e573c1e3 * fix for Mantis #27349: nested classes might also reside inside records
+ added test

git-svn-id: trunk@34714 -
2016-10-13 20:40:47 +00:00
svenbarth
ce18b10c81 * fix for Mantis #30530: when the global/static symtable is reached defowner is Nil, so respect that in the loop condition
+ added test

git-svn-id: trunk@34532 -
2016-09-16 15:39:03 +00:00
svenbarth
cb27889dea * fix cycling by correctly handling the case that the global symtable of a program file is Nil
* also check the local symtable in that case (a program does not result in a PPU, but we need the imported symbols nevertheless when linking to a package)

git-svn-id: trunk@34414 -
2016-09-02 17:22:59 +00:00
svenbarth
36e5d02e8e * addsymref: do not directly check the top level symtable against the current module's global symtable as that would be false for a specialize symtable; check the module id instead
git-svn-id: trunk@34413 -
2016-09-02 16:03:25 +00:00
Jonas Maebe
c752050728 * don't print "parameter not used" hints for abstract methods (mantis #30431)
git-svn-id: trunk@34281 -
2016-08-12 13:35:34 +00:00
pierre
ef1369fef2 Reset static recorddef variables to nil in InitSymtable, avoid crashes in TextMode IDE
git-svn-id: trunk@34203 -
2016-07-26 12:52:40 +00:00
svenbarth
54b6cacf36 Fix for Mantis #30357.
Reset tstoredsymtable.init_final_check_done when a symbol is added or removed as otherwise property getters in a record *before* any managed field would trigger it, thus leading to the record being considered as "non-managed".

git-svn-id: trunk@34088 -
2016-07-08 18:20:47 +00:00
Jonas Maebe
0ce68d223f - removed unused tllvmshadowsymtable.recordalignmin field
git-svn-id: trunk@34026 -
2016-06-30 15:33:21 +00:00
Jonas Maebe
4121facc7a * only free the llvm shadow symtable when the original symtable will
also be freed

git-svn-id: trunk@33989 -
2016-06-15 18:31:47 +00:00
Jonas Maebe
68d9eb89a2 * skip static fields while constructing the LLVM shadow symtable for structs
git-svn-id: trunk@33960 -
2016-06-12 09:21:03 +00:00
svenbarth
046614948c + new utility routine to print all parameter declarations for a specified system routine
git-svn-id: trunk@33893 -
2016-06-03 21:11:13 +00:00
svenbarth
9fd8c8718a Partial merge of r28846 (without the global assembler symbols)
To correctly generate the import library for a package we need to resolve the dangling external symbols of all units. For this each unit now stores which symbols it exported from another unit and it also stores all global and external assembler symbols it has (maybe this can be streamlined later on, but for now this works).

entfile.pas:
  + new entry for the imported unit symbols
fmodule.pas, tmodule:
  + new field unitimportsyms which holds all symbols imported by a unit from another unit
  + new method to add an imported symbol
  * create, destroy & reset: correctly instantiate/free the two new lists
fppu.pas, tppumodule:
  + new field unitimportsymsderefs to hold the derefs during loading from/storing to PPU
  + new method buildderefunitimportsyms to generate the derefs for each imported symbol
  + new method derefunitimportsyms to resolve each imported symbol deref
  + new method readunitimportsyms to read the imported symbols from the PPU
  + new method writeunitimportsyms to write all imported symbols to the PPU
  * load_implementation: read the imported symbols if their entry is encountered
  * writeppu: generate the derefs for the imported symbols and write them to the PPU
  * load_usedunits: resolve the imported symbols once all derefs are known
symtable.pas:
  * addsymref: if the symbol is not from the current unit than mark it as imported
ppu.pas:
  * increase PPU version
-- Diese und die folgenden Zeilen werden ignoriert --

M    entfile.pas
M    fmodule.pas
M    fppu.pas
M    ppu.pas
M    symtable.pas

git-svn-id: trunk@33492 -
2016-04-12 20:59:35 +00:00
Jonas Maebe
0da80d1a15 * use is_objccategory() instead of just checking for oo_is_classhelper when
looking for a category, as oo_is_classhelper is also set for Pascal
    class helpers (fixes crash caused by the fact that Object Pascal class
    helpers don't have childof set, while categories do -- mantis #29666)

git-svn-id: trunk@33193 -
2016-03-06 14:44:21 +00:00
svenbarth
02e56f410d Merged revision(s) 28689 from branches/svenbarth/packages:
Extract functionality that is shared between the metadata files for units (PPU) and for packages (PCP) into a parent class called tentryfile

+ add new unit entfile which contains the new tentryfile class and related types and constants
* ppu.pas:
    - remove methods, fields, types and constants which were moved to entfile.pas
    * replace the parts of tppuheader shared with tentryheader by a field of type tentryheader
fppu.pas, pmodules.pas, utils/ppumove.pp, utils/ppuutils/ppudump.pp:
    + add entfile to uses
    * adjust access to common header fields
node.pas, symdef.pas, symsym.pas, symtable.pas, wpoinfo.pas, utils/ppufiles.pp:
    + add entfile to uses
........

git-svn-id: trunk@32976 -
2016-01-22 15:26:30 +00:00
Jonas Maebe
99aaec5431 * handle typed constant definitions of variant records using different fields
than the one we use to construct the LLVM equivalent (which doesn't support
    variants), or in case the complete record is not defined in the source and
    has to be padded with zeroes
   o we do this by creating a new recorddef in this case with as elements the
     defs of the actually emitted constant data, and replacing the original
     def with this new def; note that this can also replace arrays in case of,
     e.g., an array of a variant record type
   o the pass in llvmtype takes care of inserting type conversions (bitcasts)
     when these constants are accessed using the original def

git-svn-id: trunk@32719 -
2015-12-25 21:05:45 +00:00
Jonas Maebe
00c777e51a * add padding byte fields all as unsigned, as that is also how we
generate them in aasmcnst

git-svn-id: trunk@32717 -
2015-12-25 21:05:36 +00:00
Jonas Maebe
abcf441c00 * moved tllvmshadowsymtable items default property from private to public
section (although the compiler doesn't seem to care about it)

git-svn-id: trunk@32716 -
2015-12-25 21:05:31 +00:00
Jonas Maebe
787caf4dda * treat records with {$packrecords c} the same as other records for LLVM
o while in principle LLVM can layout those the same as we do, this would
     require special treatment in case some fields are not initialised in
     a typed record declaration (because then we have to emit padding only
     for the skipped fields, and not for any padding between them)
   o exception: records we create to represent parameters, as those have to
     match the ABI definitions exactly for them to be treated as expected

git-svn-id: trunk@32714 -
2015-12-25 21:05:22 +00:00
Jonas Maebe
0b4f3f01b3 * fixed another case of endless recursion in
tabstractrecordsymtable.has_single_field(), due to always looking in the
    symlist of the original record rather than properly recursing into those
    of nested ones (mantis #28641)

git-svn-id: trunk@32618 -
2015-12-08 15:35:19 +00:00
Jonas Maebe
86b02cf76e * handle bitpacked ordinal fields whose size is a multiple of 8 bits the same
other bitpacked ordinal fields, since they can also start on a non-byte-
    aligned boundary

git-svn-id: trunk@32570 -
2015-12-02 22:24:04 +00:00
Jonas Maebe
00d97d54ca * don't overwrite the curroffset field while adding bytes for bitpacked fields
git-svn-id: trunk@32569 -
2015-12-02 22:24:00 +00:00
Jonas Maebe
bbbceb08d9 * fixed the number of bytes added for packed record ordinal fields in the
llvm shadow table

git-svn-id: trunk@32564 -
2015-12-01 21:52:20 +00:00
yury
17358aa3ed * Removed unused local vars.
git-svn-id: trunk@32537 -
2015-11-26 17:15:04 +00:00