Commit Graph

606 Commits

Author SHA1 Message Date
svenbarth
7343e9c4a2 * correctly handle the case should the generic dummy symbol be a procsym instead of a typesym
git-svn-id: trunk@48001 -
2021-01-02 23:23:34 +00:00
Jonas Maebe
c0c0acbcb9 * fixed llvm shadow symtable construction in case fields are reordered
(-Ooorderfields) and hence their offsets are no longer monotonically rising
  * also fixed padding for variant bitpacked records in llvm shadow symtable

git-svn-id: trunk@47853 -
2020-12-27 13:18:44 +00:00
svenbarth
3597696e98 * 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... :/

git-svn-id: trunk@47634 -
2020-11-29 15:47:52 +00:00
Jonas Maebe
cc315e0ac7 * fix tw3930 after r37927
o "unique" class (and interface) type aliases should actually not exist at
     all except for overload resolution. All the rest (VMT, UUID, RTTI, ...)
     should be taken from the aliased class/interface
   o there is one Delphi-incompatibily left after this change, but it shouldn't
     matter: tw8180 does not compile if you change the declaration to
     "tcl=class(TInterfacedObject,XStr,iinterface)", while Kylix does compile
     that. It doesn't really matter though, because in Kylix this actually
     adds iinterface twice as implemented interface, so there is no point
     in accepting this.

git-svn-id: trunk@46773 -
2020-09-05 12:25:09 +00:00
florian
392d66a9ce * variables can have the same name as the main program in iso mode, resolves #37322
git-svn-id: trunk@45757 -
2020-07-10 21:05:59 +00:00
florian
84a1f614d9 * fix several double ;
git-svn-id: trunk@45488 -
2020-05-24 17:52:09 +00:00
Jonas Maebe
a2174753c1 - removed tabstractrecorddef.get_unit_symtable, which did not always return the unit
symtable (when you had a local recorddef in a procdef)
  * modified tdef.get_top_level_symtable() so you can specify whether you want to
    skip procdefs or not
  * changed tobjectdef.vmt_def() to no longer require a typesym for the tobjectdef
    (based on patch by Blaise)

git-svn-id: trunk@45361 -
2020-05-13 21:46:29 +00:00
yury
1b3a3a7983 * Removed lot of unused local vars. It is useful to turn on the notes in options. :)
git-svn-id: trunk@44053 -
2020-01-28 18:45:33 +00:00
florian
d87a5cc9fb * take care of m_duplicate_names when checking for duplicate locals, resolves #33221
git-svn-id: trunk@44028 -
2020-01-23 21:32:09 +00:00
Jonas Maebe
1a9e246c29 * added is_normal_fieldvarsym() helper and use it
o fixes several places where there was a check whether something is a
     fieldvarsym, but not whether it's an instance rather than a class field

git-svn-id: trunk@43786 -
2019-12-24 22:12:44 +00:00
svenbarth
1779011ab4 * fix typo in comment
git-svn-id: trunk@43703 -
2019-12-20 16:44:52 +00:00
svenbarth
927c91e093 * fix for Mantis #36388: correctly handle generic constraints when looking for helpers
git-svn-id: trunk@43629 -
2019-12-02 22:29:34 +00:00
svenbarth
0a915e883e * keep track of static symbols that a global function references, as those must now be exported from a dynamic package as well if the function can potentially be inlined
git-svn-id: trunk@43544 -
2019-11-21 21:44:53 +00:00
Jonas Maebe
ac1e0f96bd * replaced tentryfile.get/putsmall/normalset() with a common tget/putset
that expects an open array of byte, and use it for all sets
   o since all sets need to be typecasted to an array type of the appropriate
     size, we'll get a compilation error in case this needs to be done and
     that also tells us at the same time that the ppu version will need to
     be increased
  * enabled {$packset 1} for the compiler, as this is now safe with the above
    changes

git-svn-id: trunk@43407 -
2019-11-06 21:50:19 +00:00
svenbarth
fdeaacac21 * fix for Mantis #36223: when parsing a helper type its extendeddef might be Nil
+ added test

git-svn-id: trunk@43346 -
2019-11-01 15:02:31 +00:00
pierre
d29a6de437 Avoid possible warning about uninitialized srsym variable
git-svn-id: trunk@42857 -
2019-08-27 12:15:03 +00:00
Jonas Maebe
bc7b90185f * when searching for a procsym in an Objective-C category for an objcclass,
try to find the procsym in the category of the objcclass that is closest
    related to the original objcclass (e.g.
     NSMutableDictionary.dictionaryWithContentsOfFile() -> prefer the
     dictionaryWithContentsOfFile() from NSMutableDictionaryCreation to the
     one from NSDictionaryCreation (part of mantis #35994)

git-svn-id: trunk@42815 -
2019-08-25 15:23:48 +00:00
Jonas Maebe
d8903ce6b3 - removed maxcrecordalign parameter/field from recordsymtables, as this value
cannot be modified in the settings (so we can directly use the one from
    current_settings)

git-svn-id: trunk@42447 -
2019-07-14 19:24:32 +00:00
svenbarth
dfb9fffcf9 + add functions for syms and defs and write sub entries of the sym/def to PPU and loads them again
git-svn-id: trunk@42399 -
2019-07-12 22:07:38 +00:00
svenbarth
a64a8f8deb - remove code to create an attribute using a synthetic function
git-svn-id: trunk@42396 -
2019-07-12 22:07:28 +00:00
svenbarth
0b63e89ba2 * make the reference to the TCustomAttribute type global
git-svn-id: trunk@42393 -
2019-07-12 22:07:15 +00:00
svenbarth
b2932393df Reintegration of Custom Attributes branch by Joost van der Sluis with patches reworked by Svetozar Belic [patch 1/3]
Implemented attributes for class types and properties (based on work by Joost van der Sluis). Added TCustomAttribute - a base class for attributes. Added TUnitInfo record to RTTI. It contains the unit name and unit options (for now only a flag which specifies if the unit contains attributes). Added several tests for attributes.

git-svn-id: trunk@42356 -
2019-07-12 22:04:48 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
svenbarth
5a5b47fa24 + add support for MultiHelpers modeswitch by Ryan Joseph for Mantis #35159
+ added tests

git-svn-id: trunk@42026 -
2019-05-10 14:04:45 +00:00
pierre
c1e93bd2c2 + 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

git-svn-id: trunk@41425 -
2019-02-23 23:03:29 +00:00
svenbarth
cb8f6f637c * fix big endian targets by using an explicit assignment with typecast instead of an absolute variable
git-svn-id: trunk@39728 -
2018-09-10 21:12:29 +00:00
svenbarth
92cce05f5f * as a workaround for some compiler bug introduced during 3.1.1 the freeing of the management operator offset entry lists is moved to a nested procedure as that does not trigger the bug (even with -O2 or -O3)
git-svn-id: trunk@39711 -
2018-09-04 20:20:07 +00:00
svenbarth
600ed6701e + keep track whether a structured type has fields with management operators (or fields that in turn have fields with management operators and so on) and store that in the PPU to speed up compilation again
* adjusted PPUdump for this

git-svn-id: trunk@39709 -
2018-09-03 18:00:27 +00:00
svenbarth
072699d38a * protect the destructors of tabstractrecordsymtable and twithsymtable against executing when called with a refcount > 1 (this fixes Mantis #34210)
+ added simplified test

git-svn-id: trunk@39693 -
2018-08-31 19:16:45 +00:00
svenbarth
21e7ddaac7 + add method to retrieve a list of management operator/field offset pairs for a specific management operator inside a structured type (no matter how deeply nested they are)
git-svn-id: trunk@39689 -
2018-08-29 19:21:31 +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