1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixes a test-case.

This commit is contained in:
Markus Schorn 2009-10-21 14:51:57 +00:00
parent 6936409241
commit 614dd157e9
2 changed files with 15 additions and 5 deletions

View file

@ -17,7 +17,9 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IndexFilter;
import org.eclipse.cdt.internal.core.index.composite.CompositeIndexBinding;
import org.eclipse.core.runtime.CoreException;
public class DeclaredBindingsFilter extends IndexFilter {
@ -50,6 +52,14 @@ public class DeclaredBindingsFilter extends IndexFilter {
|| (fAcceptImplicit && isImplicit(binding));
}
// composite bindings don't support that kind of check.
if (binding instanceof CompositeIndexBinding) {
IIndexBinding raw= ((CompositeIndexBinding) binding).getRawBinding();
if (raw instanceof IIndexFragmentBinding) {
if (((IIndexFragmentBinding) raw).hasDeclaration()) {
return true;
}
}
}
return fAcceptImplicit || !isImplicit(binding);
}

View file

@ -377,7 +377,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
}
// template<typename T> void f(T t) {}
// template<> void f(int t) {}
// template<> void f(char t) {}
//
// template<typename T> class CT {
// public:
@ -415,18 +415,18 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
String source = content[0].toString();
IFile file= createFile(getProject(), "testTemplates.cpp", source);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
CEditor editor= openEditor(file);
waitForIndexer(fIndex, file, CallHierarchyBaseTest.INDEXER_WAIT_TIME);
CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, NPM);
CEditor editor= openEditor(file);
int pos= source.indexOf("f(");
editor.selectAndReveal(pos, 1);
openCallHierarchy(editor, true);
Tree tree = getCHTreeViewer().getTree();
checkTreeNode(tree, 0, "f<T>(T)");
checkTreeNode(tree, 0, 0, "testintptr()");
checkTreeNode(tree, 0, 1, "testint()");
checkTreeNode(tree, 0, 0, "testint()");
checkTreeNode(tree, 0, 1, "testintptr()");
checkTreeNode(tree, 0, 2, null);
pos= source.indexOf("f(", pos+1);
@ -452,7 +452,7 @@ public class CppCallHierarchyTest extends CallHierarchyBaseTest {
openCallHierarchy(editor, true);
tree = getCHTreeViewer().getTree();
checkTreeNode(tree, 0, "CT<T*>::m()");
checkTreeNode(tree, 0, "CT<T *>::m()");
checkTreeNode(tree, 0, 0, "testintptr()");
checkTreeNode(tree, 0, 1, null);