1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
cdt/core
Andrew Eidsness 2279927623 Bug 400020: Allow tagging of IBindings
This new extension point allows contributors to put their own
information into the PDOM and to later retrieve it for their own
purposes.

There are many details in the bug.  The idea is that contributors
provide an implementation of IBindingTagger, which is given a chance to
examine IBindings when they are created.  The ITagWriter interface
allows the contributor to create a new tag which can then have data
written to it.

The ITagService interface (accessible from CCorePlugin.getTagService()
provides a way for the contributor to later get an instance of
ITagReader to retrieve tags from bindings.

ITags are copied to the PDOM when the associated binding is persisteed.

Contributors use a unique id (based on their plugin id), so that
multiple contributors are able to independently tag a given binding.

In-memory tags are not cached.  I've done some timing tests using my
sample implementation and found no measurable difference.  The full log
lines look like:

	!MESSAGE Indexed 'simple-01' (2 sources, 184 headers) in <see below>
sec: 21,550 declarations; 35,394 references; 0 unresolved inclusions; 1
syntax errors; 0 unresolved names (0.00%)

I did 5 tests using the current master (no tagging-related code), the
times were:
	18.86 sec
	 9.17 sec
	 5.91 sec
	 4.79 sec
	 4.83 sec

And then I ran the same sequence of tests using the code in this
commit:
	18.73 sec
	 9.39 sec
	 6.50 sec
	 4.78 sec
	 5.27 sec

If performance does become a problem, then caching could be introduced
with a new implementation of ITaggableService.  The two problems are
finding a key other than the identity of the IBinding (since IBindings
are re-created often) and properly evicting stale entries when the
binding is no longer valid.

The process of copying tags from an in-memory IBinding to a PDOMBinding,
is a synchronization.  This means that tags that are no longer
applicable, will be removed from the persistent store.

While developing this I found that PDOMBindings are not deleted from the
Database (only the names that reference them are deleted), so there is
no provision for deleting all tags at once.

New database locks are not needed.  By the time the persistent tags are
accessed, higher levels of code have already taken a read or write lock
as appropriate.

There are new unit tests covering the changes to the PDOM.

Change-Id: I8da1bf5eeba7e1fc2ca7ec308ed8e212629986a4
Reviewed-on: https://git.eclipse.org/r/10407
IP-Clean: Doug Schaefer <dschaefer@qnx.com>
Tested-by: Doug Schaefer <dschaefer@qnx.com>
Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
2013-02-20 11:27:03 -05:00
..
org.eclipse.cdt.alltests Revert "Revert "Allow unreliable tests to be avoided"" 2012-08-24 11:35:59 -07:00
org.eclipse.cdt.core Bug 400020: Allow tagging of IBindings 2013-02-20 11:27:03 -05:00
org.eclipse.cdt.core.aix Bug 393455 - Terminal sessions broken on AIX 2013-01-15 10:35:06 -05:00
org.eclipse.cdt.core.linux Remove fragment jars. Add missing property files. (Cherry picked 8_0) 2012-10-13 18:25:17 -04:00
org.eclipse.cdt.core.linux.ia64 Bumped up feature versions for Kepler. 2012-06-28 11:08:11 -07:00
org.eclipse.cdt.core.linux.ppc Bumped up feature versions for Kepler. 2012-06-28 11:08:11 -07:00
org.eclipse.cdt.core.linux.ppc64 Bumped up feature versions for Kepler. 2012-06-28 11:08:11 -07:00
org.eclipse.cdt.core.linux.x86 Bumped up feature versions for Kepler. 2012-06-28 11:08:11 -07:00
org.eclipse.cdt.core.linux.x86_64 Bumped up feature versions for Kepler. 2012-06-28 11:08:11 -07:00
org.eclipse.cdt.core.macosx Remove fragment jars. Add missing property files. (Cherry picked 8_0) 2012-10-13 18:25:17 -04:00
org.eclipse.cdt.core.qnx Bug 314504 ProcessList leaks file descriptors during #getProcessList() 2010-05-27 10:01:52 +00:00
org.eclipse.cdt.core.solaris Remove fragment jars. Add missing property files. (Cherry picked 8_0) 2012-10-13 18:25:17 -04:00
org.eclipse.cdt.core.tests Bug 400020: Allow tagging of IBindings 2013-02-20 11:27:03 -05:00
org.eclipse.cdt.core.win32 Remove fragment jars. Add missing property files. (Cherry picked 8_0) 2012-10-13 18:25:17 -04:00
org.eclipse.cdt.core.win32.x86 Bumped up feature versions for Kepler. 2012-06-28 11:08:11 -07:00
org.eclipse.cdt.core.win32.x86_64 Bumped up feature versions for Kepler. 2012-06-28 11:08:11 -07:00
org.eclipse.cdt.ui bug 401255: LSP userdef entries: Cannot add macro after adding a workspace include path 2013-02-19 23:03:33 -05:00
org.eclipse.cdt.ui.tests Bug 399142 - [regression] 'Open Declaration' does not work inside 2013-02-06 01:37:23 -05:00