Commit Graph

57 Commits

Author SHA1 Message Date
Jonas Maebe
5e3e4437c4 * use new TSym.EscapedRealName property when creating new symbols with the
same name as existing symbols

git-svn-id: trunk@47856 -
2020-12-27 13:18:53 +00:00
Jonas Maebe
312f1436b1 * changed TIDString and tsymentry.realname to TSymStr
o for TIDString: prevents shortstring -> ansistring conversions with
     -dsymansistr when looking up symbols
   o for realname: consistency with name

git-svn-id: trunk@47301 -
2020-11-03 21:34:22 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
svenbarth
6edf6cad2c * also check for Nil symtables in tsymtable.includeoption
git-svn-id: trunk@43567 -
2019-11-24 00:04:27 +00:00
svenbarth
70ae0a2dc9 + add a comment to the destructor of tsymtable so that others (and maybe me a well) will hopefully see that the destructor of that class is not completely trivial!
git-svn-id: trunk@39694 -
2018-08-31 19:16:48 +00:00
florian
a5bef2a2b9 * prevent new definitions being added to a global unit symtable after compilation of the implementation part started
git-svn-id: trunk@29811 -
2015-02-23 22:10:46 +00:00
paul
5aa919c2a8 compiler: have unit interface symtable in stack while parsing implementation uses list (fixes issue #10477)
git-svn-id: trunk@25505 -
2013-09-17 08:53:37 +00:00
Jonas Maebe
1bc846dd3c + TSymtablestack.getcopyuntil() method that creates a copy of a
symtablestack up to and including a particular symtable

git-svn-id: branches/jvmbackend@18582 -
2011-08-20 08:12:29 +00:00
svenbarth
f7f357f18e * symconst.pas:
- remove thelpersearch again => adjustments to searchsym_in_class and calls to it
- rename sto_has_classhelper to sto_has_helper
* symbase.pas: make push and pop in tsymtablestack virtual
* symdef.pas:
- add a new class tdefawaresymtablestack which overrides push and pop of tsymtablestack and adjusts the new extendeddefs field of the current tmodule
- tobjectdef.create: sto_has_classhelper => sto_has_helper
* fmodule.pas:
- add new hash object list to tmodule (key: mangled type name) which holds object list instances that contain all helpers currently active for a given type (= key of the hash list)
- tmodule.create: the hash list owns the sublists (but those don't own the defs)
- tmodule.destroy: free the hash list
* pdecobjpas:
- rename parse_extended_class to parse_extended_type
- parsing of constructors:
# for all helper types: no class constructors allowed
# for record helpers: as long as constructors for records themselves are disabled they are for record helpers as well
- object_dec: manually add the helper to the extendeddefs if the overall owner of the current def is a static symtable (implementation section or program/library main file), because the symtable won't be popped and pushed then
* parser.pas: instantiate the new stack class
* psub.pas: backup the extendeddefs in specialize_objectdefs as well
* ptype.pas:
- generate_specialization: backup the extendeddefs as well
- record_dec: _RECORD is now consumed in read_named_type itself
- read_named_type: parse "record helper" if advanced record syntax is enabled
* symtable.pas:
- correct searchsym_in_class declaration => adjustments in this unit as well
- add the possibility to pass a context def to search_last_objectpascal_helper
- rename search_objectpascal_class_helper to search_objectpascal_helper
- rename search_class_helper to search_objc_helper
- searchsym_in_class: 
# search for helpers in every level of the tree of the class
# the contextclassh can also be a subclass of the extendeddef
- searchsym_in_record: search for helper methods as well
- searchsym_in_helper:
# search for symbols in class and record helpers is the same except for the search in the class' ancestors
# search the extendeddef directly and rely on searchsym_in_class only for the class' ancestors as we need to find the helpers there as well
- search_last_objectpascal_helper: use the extendeddefs list of current_module instead of scanning the symbol stack itself
* pexpr.pas: adjustments because of renaming of sto_has_classhelper
* pinline.pas: adjustment because of removing of thelpersearch
* nflw.pas: 
- renamed classhelper to helperdef
- adjusted search_last_objectpascal_helper call
* msg*:
- adjusted error message for constructors in records (this currently applies to record helpers as well)
- renamed parser_e_not_allowed_in_classhelper to parser_e_not_allowed_in_helper => adjustments in code
- added parser_e_no_class_constructors_in_helpers
* pdecsub.pas: adjusted renamed error message
* htypechk.pas: check for helpers in every step of the hierarchy
* nobj.pas: search_class_helper => search_objc_helper
* utils/ppudump.pas: adjust, because of renames

Note: the define "useoldsearch" will be only used for performance comparison on my (faster) Linux machine; that (and its associated code) will be removed afterwards

git-svn-id: branches/svenbarth/classhelpers@17151 -
2011-03-20 11:27:27 +00:00
svenbarth
7cc7826343 - msg*: found a message to reuse
- pdecobj.pas: removed a check whether a class (helper) tries to inherit from a class helper, because now single_type handles this
- pexpr.pas: 
* prohibit type casts to class helpers (note: this might be needed for ObjC categories as well)
* class helper references may only be used when inheriting from them (needs to be checked for ObjC categories as well)
- ptype.pas:
* single_type: extend check against categories for class helpers
* read_named_type: extend check against categories for class helpers
- symbase.pas: add a method that adds symbol table flags recursivly to a stack of symtables (it stops updating the symtables once a symtable already has that flag or it's a global-/staticsymtable)
- symdef.pas: adjusted the constructor of tobjectdef to use the new method for adding flags 

git-svn-id: branches/svenbarth/classhelpers@16889 -
2011-02-07 18:59:09 +00:00
svenbarth
e19bcfae38 Added a flag set to TSymtable that tells whether it contains a class helper symbol, which is currently only used for static- and globalsymtables.
symconst.pas: added new enum tsymtableoption with set tsymtableoptions; currently it contains only sto_has_classhelper, but refactoring tstoredsymtable.b_needs_init_final is on the todo list
ppu.pas: added a new entry type that will hold the symtable options (91)
symbase.pas: added a new field "tableoptions" to TSymtable which will hold the flags of the symtable (only saved by tstoredsymtable)
symdef.pas: when a tobjectdef is created as a odt_classhelper or odt_objccategory the flag sto_has_classhelper is added to its owning global- or staticsymtable
symtable.pas: 
* load and write the symtable's options as a small set to an entry before the definition entries
* tabstractlocalsymtable needed to annoy me by not calling "inherited writeppu" which does the same as tabstractsymtable did before
* search_last_objectpascal_classhelper: check whether the static- or globalsymtable contains a class helper at all; if not then just continue with the next
utils/ppudump.pas:
* added reading of symtableoptions entry (as readsymtableoptions) based on the reading of tsym options
* added the reading of symtableoptions before every read of the contents of a TSymtable (definitions, symbols)

git-svn-id: branches/svenbarth/classhelpers@16845 -
2011-01-30 09:19:59 +00:00
Jonas Maebe
5a2ccfff52 --WARNING: start build process with FPC 2.2.4; won't work when
starting with a previous 2.3.1 or compiler built from the objc branch
  + added basic objcprotocol support (only for external protocols
    currently)
     o use in type declaration: "type xp = objcprotocol ... end;"
     o when defining a root class that implements it:
       "type yc = objcclass(xp) ... end" (note: no support yet
       for something like "objcclass(id,xp)" or so)
     o when defining a non-root class that implements a protocol:
       "type zc = objcclass(nsobject,xp) ... end"
     o includes support for "required" and "optional" sections
     o no support yet for the objcprotocol(<protocol>) expression
       that enables getting a class instance representing the
       protocol (e.g., for use with "conformsToProtocol:")
     o message names have to specified in protocol declarations,
       but if an objcclass implements a protocol, the message names do
       not have to be repeated (but if they are, they have to match;
       the same goes when overriding inherited methods)
  + allow specifying the external name of Objective-C classes and
    protocols, since classes and protocols can have the same name
    (and you cannot use the same Pascal identifier in such caseq)
  + added NSObject protocol, and make the NSObject class use it
  + added missing NSObject class methods that have the same name
    as instance methods (added "class" name prefix to avoid clashes)
  * fixed several cases where the compiler did not treat Objective-C
    classes/protocols the same as Object Pascal classes/interfaces
    (a.o., forward declarations, alignment, regvars, several type
     conversions, ...)
  * allow "override" directive in objcclass declarations, and print
    a hint if it's forgotten in an external declaration (because it
    doesn't really matter there, and may make automated header
    conversion harder than necessary) and an error if will be used in
    a non-external declaration (because it is not possible to start
    a new vmt entry-tree in Objective-C, you can only override parent
    methods)
  * reject objcclasses/protocols as parameters to typeof()
  * don't try to test VMT validity of objcclasses/protocols

git-svn-id: branches/objc@13375 -
2009-07-09 20:48:28 +00:00
peter
a3a66ba74d * split tvisibility from tsymoptions
* replace current_object_option with symtable.currentvisibility

git-svn-id: trunk@12048 -
2008-11-11 09:05:39 +00:00
peter
af437d5beb * refactor the forward type declaration handling, remove
global typecanbeforward and move 'class of ..' parsing
    to ptype

git-svn-id: trunk@12045 -
2008-11-09 22:07:36 +00:00
Jonas Maebe
597622d313 * moved the forwardchecksyms back to symbase (but the main functionality
remains in symtable) to simplify (and fix) its memory management

git-svn-id: trunk@11772 -
2008-09-13 19:59:21 +00:00
Jonas Maebe
0b815a6fff - removed global "resolving_forward" variable (was no longer used)
* moved forward type checking from pdecl/symbase to symtable/symsym

git-svn-id: trunk@11763 -
2008-09-13 12:28:55 +00:00
Jonas Maebe
156acf3817 * fixed version of r11719 (faster parsing of units with lots of declarations
in many different type blocks)

git-svn-id: trunk@11722 -
2008-09-07 13:51:04 +00:00
Jonas Maebe
f35051f76e - reverted r11719, there are still some problems with it
git-svn-id: trunk@11720 -
2008-09-07 12:45:08 +00:00
Jonas Maebe
632abdace8 * keep the syms that need to be checked for forward definitions in a
separate list, so that procsyms, constsym, varsyms etc are not checked
    and so that every sym is checked only once (rather than at the end
    of every type block). This makes parsing units with lots of declarations
    much faster (e.g., compiling MacOSAll is now 2 to 3 times faster)

git-svn-id: trunk@11719 -
2008-09-07 12:24:57 +00:00
peter
91dbd27a42 * cleanup deleting of defs
git-svn-id: trunk@5902 -
2007-01-11 20:46:57 +00:00
peter
45621c892e * set vs_initialised for typed consts
* delete old symbol when absolute is used

git-svn-id: trunk@5351 -
2006-11-13 07:42:48 +00:00
peter
0c8796c210 * fix hiding of symbols
git-svn-id: trunk@5272 -
2006-11-07 08:53:15 +00:00
peter
658c46b903 * remove tdictionary and tindexarray
* symtables based on TFPHashObjectList and TFPObjectList
  * rename torddef.typ to torddef.ordtype
  * rename tfloatdef.typ to tfloatdef.floattype
  * rename tdef.deftype to tdef.typ
  * remove obsolete browser code, browcol is kept so the ide
    can still be compiled

git-svn-id: trunk@5192 -
2006-11-03 00:30:30 +00:00
peter
cb246eb781 * Remove dos,strings units, use SysUtils instead
* replace split* functions with Extract* functions
  * Add Directory caching

git-svn-id: trunk@5102 -
2006-10-30 23:29:35 +00:00
peter
d4d4309e44 * use unique symid and defid per module
git-svn-id: trunk@5061 -
2006-10-29 13:00:22 +00:00
peter
b7fe6797bf Merged revisions 2921-2922,2925 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/linker/compiler

........
r2921 | peter | 2006-03-15 08:35:00 +0100 (Wed, 15 Mar 2006) | 2 lines

  * pass ObjectWriter to ObjectOuput

........
r2922 | peter | 2006-03-15 12:40:30 +0100 (Wed, 15 Mar 2006) | 2 lines

  * refactor asmdata

........
r2925 | peter | 2006-03-15 16:09:39 +0100 (Wed, 15 Mar 2006) | 3 lines

  * add cfi to asmdata
  * move asmlist, asmcfi, asmdata to own unit

........

git-svn-id: trunk@2932 -
2006-03-16 08:52:22 +00:00
peter
785550d7e3 Merged revisions 2669,2673,2677,2683,2696,2699-2702,2704,2708,2712-2715,2718,2722-2723,2728-2730,2740,2769 via svnmerge from
svn+ssh://peter@www.freepascal.org/FPC/svn/fpc/branches/linker/compiler

........
r2669 | peter | 2006-02-23 09:31:21 +0100 (Thu, 23 Feb 2006) | 2 lines

  * add compiler dir

........
r2673 | peter | 2006-02-23 17:08:56 +0100 (Thu, 23 Feb 2006) | 2 lines

  * enabled more code

........
r2677 | peter | 2006-02-24 17:46:29 +0100 (Fri, 24 Feb 2006) | 2 lines

  * pe stub and headers

........
r2683 | peter | 2006-02-25 23:13:24 +0100 (Sat, 25 Feb 2006) | 2 lines

  * section options cleanup

........
r2696 | peter | 2006-02-26 20:27:41 +0100 (Sun, 26 Feb 2006) | 2 lines

  * fixed typecasts

........
r2699 | peter | 2006-02-26 23:04:32 +0100 (Sun, 26 Feb 2006) | 2 lines

  * simple linking works

........
r2700 | peter | 2006-02-27 09:44:50 +0100 (Mon, 27 Feb 2006) | 2 lines

  * internal linker script

........
r2701 | peter | 2006-02-27 12:05:12 +0100 (Mon, 27 Feb 2006) | 2 lines

  * make elf working again

........
r2702 | peter | 2006-02-27 14:04:43 +0100 (Mon, 27 Feb 2006) | 3 lines

  * disable dwarf for smartlinking with .a
  * fix section start in new .a file

........
r2704 | peter | 2006-02-27 18:30:43 +0100 (Mon, 27 Feb 2006) | 2 lines

  * stab section fixes

........
r2708 | peter | 2006-02-28 19:29:17 +0100 (Tue, 28 Feb 2006) | 2 lines

  * basic work to merge stabs sections

........
r2712 | peter | 2006-02-28 23:17:48 +0100 (Tue, 28 Feb 2006) | 2 lines

  * unload tmodules before linking

........
r2713 | peter | 2006-02-28 23:18:51 +0100 (Tue, 28 Feb 2006) | 2 lines

  * fixed stabs linking

........
r2714 | peter | 2006-02-28 23:19:19 +0100 (Tue, 28 Feb 2006) | 2 lines

  * show code and data size

........
r2715 | peter | 2006-02-28 23:25:35 +0100 (Tue, 28 Feb 2006) | 2 lines

  * unload .stabs from objdata after it is merged

........
r2718 | peter | 2006-03-01 12:24:38 +0100 (Wed, 01 Mar 2006) | 3 lines

  * memsize/datasize cleanup
  * check for exports/resources when adding module to linker

........
r2722 | peter | 2006-03-03 09:12:20 +0100 (Fri, 03 Mar 2006) | 2 lines

  * new TObjSymbol splitted from TAsmSymbol

........
r2723 | peter | 2006-03-03 14:08:55 +0100 (Fri, 03 Mar 2006) | 2 lines

  * coff fixes after recent objsymbol changes

........
r2728 | peter | 2006-03-03 22:43:04 +0100 (Fri, 03 Mar 2006) | 2 lines

  * fixed coff writer

........
r2729 | peter | 2006-03-04 01:10:32 +0100 (Sat, 04 Mar 2006) | 2 lines

  * fix read-only opening

........
r2730 | peter | 2006-03-04 01:11:16 +0100 (Sat, 04 Mar 2006) | 2 lines

  * Read edata from DLLs, basic work

........
r2740 | peter | 2006-03-04 21:13:43 +0100 (Sat, 04 Mar 2006) | 3 lines

  * deletedef added
  * don't remove defs from index when we are already clearing everything

........
r2769 | peter | 2006-03-05 21:42:33 +0100 (Sun, 05 Mar 2006) | 4 lines

  * moved TObj classes to ogbase
  * ObjSection.SymbolRefs and SymbolDefines list
  * DLL importing

........

git-svn-id: trunk@2771 -
2006-03-05 21:10:37 +00:00
peter
232555904e * symtablestack cleanup and rewrite
git-svn-id: trunk@2448 -
2006-02-05 22:24:18 +00:00
peter
89297d2c39 * move all stabs ($ifdef gdb) code to dbgstabs
git-svn-id: trunk@1255 -
2005-10-02 11:17:05 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
peter
8d251e8506 * unit mapping rewrite
* new derefmap added
2005-01-19 22:19:41 +00:00
olle
7572f3a539 * rework of macro subsystem
+ exportable macros for mode macpas
2005-01-09 20:24:43 +00:00
mazen
581b52422c - remove $IFDEF DELPHI and related code
- remove $IFDEF FPCPROCVAR and related code
2004-10-15 09:14:16 +00:00
peter
a939095dbe * revert has_localst patch
* replace aktstaticsymtable/aktglobalsymtable with current_module
2004-07-09 22:17:31 +00:00
florian
8a9758c5e2 * logs truncated 2004-06-20 08:55:28 +00:00
florian
61f15e4ec4 * make cycle fixed
+ pic support for darwin
  + support of importing vars from shared libs on darwin implemented
2004-03-02 17:32:12 +00:00
daniel
d735071838 * Rtti generation moved to ncgutil
* Assmtai usage of symsym removed
  * operator overloading cleanup up
2004-02-04 22:15:15 +00:00
daniel
7a6b6f4bd4 * Some minor stuff
* Managed to eliminate speed effects of string compression
2004-01-15 15:16:17 +00:00
daniel
4a4b8f2a72 * Experiment: Compress strings to save memory
Did not save a single byte of mem; clearly the core size is boosted by
    temporary memory usage...
2004-01-11 23:56:19 +00:00
peter
9aba5c8c7a * fixed some crashes
* fixed varargs and register calling probs
2003-12-01 18:44:15 +00:00
peter
8af51ea6d3 * locals and paras are allocated in the code generation
* tvarsym.localloc contains the location of para/local when
    generating code for the current procedure
2003-09-23 17:56:05 +00:00
peter
bfb8ae2151 * sym,def resolving partly rewritten to support also parent objects
not directly available through the uses clause
2003-06-25 18:31:23 +00:00
peter
e7975c7592 * re-resolving added instead of reloading from ppu
* tderef object added to store deref info for resolving
2003-06-07 20:26:32 +00:00
peter
60978ba89c * aktprocdef renamed to current_procdef
* procinfo renamed to current_procinfo
  * procinfo will now be stored in current_module so it can be
    cleaned up properly
  * gen_main_procsym changed to create_main_proc and release_main_proc
    to also generate a tprocinfo structure
  * fixed unit implicit initfinal
2003-04-27 11:21:32 +00:00
peter
7f14891d66 * aktprocdef cleanup, aktprocdef is now always nil when parsing
a new procdef declaration
  * aktprocsym removed
  * lexlevel removed, use symtable.symtablelevel instead
  * implicit init/final code uses the normal genentry/genexit
  * funcret state checking updated for new funcret handling
2003-04-27 07:29:50 +00:00
carl
081a4aab35 * 3% memory optimization
* changed some types
  + added type checking with different size for call node and for
     parameters
2002-12-07 14:27:07 +00:00
peter
a6bdf6703d * tsymtable.dump to dump the names in a symtable to stdout 2002-10-02 20:51:59 +00:00
peter
a540ff122c * tdicationary.replace added to replace and item in a dictionary. This
is only allowed for the same name
  * varsyms are inserted in symtable before the types are parsed. This
    fixes the long standing "var longint : longint" bug
  - consume_idlist and idstringlist removed. The loops are inserted
    at the callers place and uses the symtable for duplicate id checking
2002-09-09 17:34:14 +00:00