From 5e793c9b43db33e8eef92ba49b26c3936a73ecee Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 8 Feb 2017 16:41:52 -0400 Subject: [PATCH] Revert "Bug 399147 - Make 'Find Reference' find using-declarations" The change is invalid since a PDOMName can participate in only one binding at a time through its BINDING_PREV_OFFSET/ BINDING_PREV_OFFSET pointers. This reverts commit 2706699543e0a42eaa4efddb52b3a54635f8ae30. Change-Id: I1a4dd7b189b85a0d9c1cca2660d33ab7351a025c --- .../cdt/internal/pdom/tests/NamespaceTests.java | 2 +- .../cdt/internal/core/pdom/dom/PDOMName.java | 13 ------------- .../cdt/ui/tests/search/FindReferencesTest.java | 11 ----------- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/NamespaceTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/NamespaceTests.java index 43062a9da00..70a6cc6ecb5 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/NamespaceTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/NamespaceTests.java @@ -209,6 +209,6 @@ public class NamespaceTests extends PDOMTestBase { assertEquals(0, decls.length); IName[] refs = pdom.findNames(variable1, IIndex.FIND_REFERENCES); - assertEquals(3, refs.length); + assertEquals(2, refs.length); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java index 86812964a88..d6fa4511b9c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMName.java @@ -18,8 +18,6 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ast.IASTFileLocation; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration; import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexName; import org.eclipse.cdt.core.index.IndexLocationFactory; @@ -79,17 +77,6 @@ public final class PDOMName implements IIndexFragmentName, IASTFileLocation { break; case IS_DECLARATION: binding.addDeclaration(this); - - // The name of a using-declaration is, in addition to the declaration of - // the using-declaration binding, a reference to its delegate bindings. - if (binding instanceof ICPPUsingDeclaration) { - for (IBinding delegate : ((ICPPUsingDeclaration) binding).getDelegates()) { - if (delegate instanceof PDOMBinding) { - ((PDOMBinding) delegate).addReference(this); - } - } - } - break; case IS_REFERENCE: binding.addReference(this); diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/FindReferencesTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/FindReferencesTest.java index 559caaccd50..0dd3aa7cff9 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/FindReferencesTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/FindReferencesTest.java @@ -126,17 +126,6 @@ public class FindReferencesTest extends SearchTestBase { assertNotNull(matches[0].getEnclosingElement()); } - // namespace N { - // void foo(); - // } - // using N::foo; - - // // empty file - public void testUsingDeclaration_399147() throws Exception { - CSearchQuery query = makeSearchQuery(fHeaderFile, selectSection("foo", "void foo", fHeaderContents)); - assertOccurrences(query, 1); - } - // // empty file // namespace { struct A {}; }