1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +02:00
cdt/core
Andrew Eidsness 4dab99404c Bug 422681: Load the correct binding for cross-linkage references
The test case in the previous commit was invalid.  The test case did not
modify the binding that was referenced by the name and it was checking
for the wrong binding after reading the reference from the Database.
Further, the test case had a hole where the type of binding that was
being used happens to have same node type in both the C and C++
linkages.

I've fixed the test case as follows:

1) The test type is now an enum which has a different nodeType in the C
and C++ linkages.  The test case will now be able to catch cases where
the wrong linkage is used when reading the binding.

2) The test case now changes the name to reference a binding in a
different linkage.  This means the later code (in the test case) is
expected to actually load a binding from a different linkage.

3) The test case now checks that the loaded binding really did come from
the other linkage.  The previous implementation of the test case was
using the wrong binding for the checks.

I've also updated the implementation so that the updated test case
passes.

As an aside, during this update we (Doug and I) noticed that PDOMNames
unnecessarily store a PDOMLinkage.  Bindings come from languages, and
therefore need a PDOMLinkage (so that the proper type can be loaded).
Names reference bindings and therefore should not have a linkage.  The
motivating example is that there should be one binding for the printf
function, but it could be referenced using names that are created by
different parsers.  This can be fixed in a later change.

The major change to implementation is that PDOMNode now stores an
identifier for the factory to use when loading the node.  PDOMNode was
already using an int to store the nodeType.  I've split this to store
the factoryId as a short and the nodeType as a short.  The highest
nodeType currently in use is 58 -- a short should provide ample room for
expansion.

Since PDOMNode is now able to pick the proper factory for loading, we no
longer need the PDOMLinkage.getNode(long) method and I've marked it
deprecated.  Instead there is a new method PDOMNode.load(PDOM, long).
Nodes read their factoryId from the database, so the PDOMLinkage is not
needed.

Later commits should cleanup the following:

    a) Remove PDOMLinkage from PDOMNode (and related)
    b) Change return type of PDOMNode.getNodeType to short
    c) Replace deprecated calls to PDOMLinkage.getNode

Among these changes, (a) should allow removal of the external references
list.  If names can be loaded without a linkage, then there would be no
reason to store the linkage when storing the name.

Change-Id: Ife2b21cb21ed1ac6d6c361d0ffb8c7434832c79c
Signed-off-by: Andrew Eidsness <eclipse@jfront.com>
Reviewed-on: https://git.eclipse.org/r/19377
Tested-by: Hudson CI
Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
IP-Clean: Doug Schaefer <dschaefer@qnx.com>
2013-12-05 13:39:03 -05:00
..
org.eclipse.cdt.alltests Cosmetics. 2013-12-03 18:05:48 -08:00
org.eclipse.cdt.core Bug 422681: Load the correct binding for cross-linkage references 2013-12-05 13:39:03 -05:00
org.eclipse.cdt.core.aix Bug 406479 - Some "org.eclipse.cdt.core" fragments are missing an 2013-09-26 11:37:38 -04:00
org.eclipse.cdt.core.linux Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.core.linux.ia64 Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.core.linux.ppc Bug 406479 - Some "org.eclipse.cdt.core" fragments are missing an 2013-09-26 11:37:38 -04:00
org.eclipse.cdt.core.linux.ppc64 Bug 406479 - Some "org.eclipse.cdt.core" fragments are missing an 2013-09-26 11:37:38 -04:00
org.eclipse.cdt.core.linux.x86 Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.core.linux.x86_64 Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.core.macosx Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.core.qnx
org.eclipse.cdt.core.solaris Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.core.tests Bug 422681: Load the correct binding for cross-linkage references 2013-12-05 13:39:03 -05:00
org.eclipse.cdt.core.win32 Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.core.win32.x86 Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.core.win32.x86_64 Fixed parent pom version to reference 2013-08-27 15:16:24 -04:00
org.eclipse.cdt.ui Bug 423126 - Extract Function refactoring misses additional occurrences 2013-12-03 18:16:43 -08:00
org.eclipse.cdt.ui.tests Bug 423126 - Extract Function refactoring misses additional occurrences 2013-12-03 18:16:43 -08:00