diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java index 34d2706afaa..f63a74baa1c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java @@ -30,6 +30,7 @@ import org.eclipse.cdt.core.testplugin.CProjectHelper; import org.eclipse.cdt.core.testplugin.CTestPlugin; import org.eclipse.cdt.core.testplugin.util.BaseTestCase; import org.eclipse.cdt.core.testplugin.util.TestSourceReader; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -271,7 +272,7 @@ public class IndexNamesTests extends BaseTestCase { for (IIndexName indexName : names) { if (indexName.isReference() && indexName.toString().equals("vm")) { assertEquals(couldbepolymorphic[j], indexName.couldBePolymorphicMethodCall()); - assertEquals(container[j], fIndex.findBinding(indexName).getQualifiedName()[0]); + assertEquals(container[j], CPPVisitor.getQualifiedName(fIndex.findBinding(indexName))[0]); j++; } else { @@ -279,8 +280,7 @@ public class IndexNamesTests extends BaseTestCase { } } assertEquals(couldbepolymorphic.length, j); - } - finally { + } finally { fIndex.releaseReadLock(); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNamespaceScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNamespaceScope.java index 09f5bc21a16..1f133a2c0ae 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNamespaceScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNamespaceScope.java @@ -34,6 +34,7 @@ import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndexFileSet; import org.eclipse.cdt.core.index.IIndexName; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPScopeMapper.InlineNamespaceDirective; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.index.IIndexScope; import org.eclipse.core.runtime.CoreException; @@ -97,23 +98,23 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace @Override public IName getScopeName() { IASTNode node = getPhysicalNode(); - if( node instanceof ICPPASTNamespaceDefinition ){ + if (node instanceof ICPPASTNamespaceDefinition) { return ((ICPPASTNamespaceDefinition)node).getName(); } return null; } public IScope findNamespaceScope(IIndexScope scope) { - final String[] qname= scope.getScopeBinding().getQualifiedName(); + final String[] qname= CPPVisitor.getQualifiedName(scope.getScopeBinding()); final IScope[] result= {null}; - final ASTVisitor visitor= new ASTVisitor () { + final ASTVisitor visitor= new ASTVisitor() { private int depth= 0; { shouldVisitNamespaces= shouldVisitDeclarations= true; } @Override public int visit( IASTDeclaration declaration ){ - if( declaration instanceof ICPPASTLinkageSpecification ) + if (declaration instanceof ICPPASTLinkageSpecification) return PROCESS_CONTINUE; return PROCESS_SKIP; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/DefaultFragmentBindingComparator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/DefaultFragmentBindingComparator.java index 669f14dd6bd..404c0770b58 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/DefaultFragmentBindingComparator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/DefaultFragmentBindingComparator.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.index; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; + /** * Binding comparator suitable for C/C++ across index implementations. This will not be used * unless we ever have non-PDOM implementations of IIndexFragment, and in that case we may find @@ -17,7 +19,7 @@ package org.eclipse.cdt.internal.core.index; */ public class DefaultFragmentBindingComparator implements IIndexFragmentBindingComparator { public int compare(IIndexFragmentBinding a, IIndexFragmentBinding b) { - int cmp= compareQualifiedNames(a.getQualifiedName(), b.getQualifiedName()); + int cmp= compareQualifiedNames(CPPVisitor.getQualifiedName(a), CPPVisitor.getQualifiedName(b)); if (cmp == 0) { int ac= a.getBindingConstant(), bc= b.getBindingConstant(); cmp= ac < bc ? -1 : (ac > bc ? 1 : 0); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java index 74420f77ad4..5078a6a6de1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java @@ -31,6 +31,7 @@ import org.eclipse.cdt.core.index.IndexFilter; import org.eclipse.cdt.core.parser.Keywords; import org.eclipse.cdt.core.parser.util.ArrayUtil; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants; import org.eclipse.cdt.internal.core.index.IIndexScope; import org.eclipse.cdt.internal.core.model.ASTStringUtil; @@ -246,7 +247,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding @Override protected String toStringBase() { - String[] names = getQualifiedName(); + String[] names = CPPVisitor.getQualifiedName(this); if (names.length == 0) { return ""; //$NON-NLS-1$ } @@ -255,7 +256,8 @@ class PDOMCPPNamespace extends PDOMCPPBinding public ICPPNamespaceScope[] getInlineNamespaces() { if (fInlineNamespaces == null) { - List nslist = collectInlineNamespaces(getDB(), getLinkage(), record+FIRST_NAMESPACE_CHILD_OFFSET); + List nslist = collectInlineNamespaces(getDB(), getLinkage(), + record + FIRST_NAMESPACE_CHILD_OFFSET); if (nslist == null) { fInlineNamespaces= new PDOMCPPNamespace[0]; } else { @@ -265,8 +267,8 @@ class PDOMCPPNamespace extends PDOMCPPBinding return fInlineNamespaces; } - public static List collectInlineNamespaces(Database db, - PDOMLinkage linkage, long listRecord) { + public static List collectInlineNamespaces(Database db, PDOMLinkage linkage, + long listRecord) { List nslist= null; try { long rec= db.getRecPtr(listRecord); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java index f1564244fbf..4c770397267 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java @@ -86,6 +86,7 @@ import org.eclipse.cdt.ui.text.ICHelpInvocationContext; import org.eclipse.cdt.ui.text.SharedASTJob; import org.eclipse.cdt.utils.PathUtil; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.cdt.internal.core.resources.ResourceLookup; import org.eclipse.cdt.internal.corext.codemanipulation.AddIncludesOperation; @@ -647,7 +648,7 @@ public class AddIncludeOnSelectionAction extends TextEditorAction { * @throws CoreException */ private static String getBindingQualifiedName(IIndexBinding binding) throws CoreException { - String[] qname= binding.getQualifiedName(); + String[] qname= CPPVisitor.getQualifiedName(binding); StringBuilder result = new StringBuilder(); boolean needSep= false; for (String element : qname) {