mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
227976: apply fix
This commit is contained in:
parent
22d13071b2
commit
7364e1ddaf
12 changed files with 168 additions and 161 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
||||
* Copyright (c) 2007, 2008 Symbian Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -60,64 +60,6 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
public static class SingleProject extends IndexCPPTemplateResolutionTest {
|
||||
public SingleProject() {setStrategy(new SinglePDOMTestStrategy(true));}
|
||||
|
||||
// template<typename _TpAllocator>
|
||||
// class Allocator {
|
||||
// public:
|
||||
// typedef _TpAllocator& alloc_reference;
|
||||
// template<typename _TpRebind>
|
||||
// struct rebind {
|
||||
// typedef Allocator<_TpRebind> other;
|
||||
// };
|
||||
// };
|
||||
//
|
||||
// template<typename _Tp, typename _Alloc = Allocator<_Tp> >
|
||||
// class Vec {
|
||||
// public:
|
||||
// typedef typename _Alloc::template rebind<_Tp>::other::alloc_reference reference;
|
||||
// };
|
||||
|
||||
// void f(Vec<int>::reference r) {}
|
||||
public void testRebindPattern_214017_1() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("r)", 1);
|
||||
assertInstance(b0, ICPPVariable.class);
|
||||
IType type = ((ICPPVariable) b0).getType();
|
||||
type = SemanticUtil.getUltimateType(type, false);
|
||||
assertInstance(type, IBasicType.class);
|
||||
assertEquals("int", ASTTypeUtil.getType(type));
|
||||
}
|
||||
|
||||
// template<typename _TpAllocator>
|
||||
// class Allocator {
|
||||
// public:
|
||||
// typedef _TpAllocator& alloc_reference;
|
||||
// template<typename _TpRebind>
|
||||
// struct rebind {
|
||||
// typedef Allocator<_TpRebind> other;
|
||||
// };
|
||||
// };
|
||||
//
|
||||
// template<typename _TpBase, typename _AllocBase>
|
||||
// class VecBase {
|
||||
// public:
|
||||
// typedef typename _AllocBase::template rebind<_TpBase>::other _Tp_alloc_type;
|
||||
// };
|
||||
//
|
||||
// template<typename _Tp, typename _Alloc = Allocator<_Tp> >
|
||||
// class Vec : protected VecBase<_Tp, _Alloc> {
|
||||
// public:
|
||||
// typedef typename VecBase<_Tp, _Alloc>::_Tp_alloc_type::alloc_reference reference;
|
||||
// };
|
||||
|
||||
// void f(Vec<int>::reference r) {}
|
||||
public void testRebindPattern_214017_2() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("r)", 1);
|
||||
assertInstance(b0, ICPPVariable.class);
|
||||
IType type = ((ICPPVariable) b0).getType();
|
||||
type = SemanticUtil.getUltimateType(type, false);
|
||||
assertInstance(type, IBasicType.class);
|
||||
assertEquals("int", ASTTypeUtil.getType(type));
|
||||
}
|
||||
|
||||
// template<typename _TpAllocatorForward>
|
||||
// class Allocator;
|
||||
//
|
||||
|
@ -165,64 +107,6 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
|
||||
public static class ProjectWithDepProj extends IndexCPPTemplateResolutionTest {
|
||||
public ProjectWithDepProj() {setStrategy(new ReferencedProject(true));}
|
||||
|
||||
// template<typename _TpAllocator>
|
||||
// class Allocator {
|
||||
// public:
|
||||
// typedef _TpAllocator& alloc_reference;
|
||||
// template<typename _TpRebind>
|
||||
// struct rebind {
|
||||
// typedef Allocator<_TpRebind> other;
|
||||
// };
|
||||
// };
|
||||
//
|
||||
// template<typename _Tp, typename _Alloc = Allocator<_Tp> >
|
||||
// class Vec {
|
||||
// public:
|
||||
// typedef typename _Alloc::template rebind<_Tp>::other::alloc_reference reference;
|
||||
// };
|
||||
|
||||
// void f(Vec<int>::reference r) {}
|
||||
public void _testRebindPattern_214017_1() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("r)", 1);
|
||||
assertInstance(b0, ICPPVariable.class);
|
||||
IType type = ((ICPPVariable) b0).getType();
|
||||
type = SemanticUtil.getUltimateType(type, false);
|
||||
assertInstance(type, IBasicType.class);
|
||||
assertEquals("int", ASTTypeUtil.getType(type));
|
||||
}
|
||||
|
||||
// template<typename _TpAllocator>
|
||||
// class Allocator {
|
||||
// public:
|
||||
// typedef _TpAllocator& alloc_reference;
|
||||
// template<typename _TpRebind>
|
||||
// struct rebind {
|
||||
// typedef Allocator<_TpRebind> other;
|
||||
// };
|
||||
// };
|
||||
//
|
||||
// template<typename _TpBase, typename _AllocBase>
|
||||
// class VecBase {
|
||||
// public:
|
||||
// typedef typename _AllocBase::template rebind<_TpBase>::other _Tp_alloc_type;
|
||||
// };
|
||||
//
|
||||
// template<typename _Tp, typename _Alloc = Allocator<_Tp> >
|
||||
// class Vec : protected VecBase<_Tp, _Alloc> {
|
||||
// public:
|
||||
// typedef typename VecBase<_Tp, _Alloc>::_Tp_alloc_type::alloc_reference reference;
|
||||
// };
|
||||
|
||||
// void f(Vec<int>::reference r) {}
|
||||
public void _testRebindPattern_214017_2() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("r)", 1);
|
||||
assertInstance(b0, ICPPVariable.class);
|
||||
IType type = ((ICPPVariable) b0).getType();
|
||||
type = SemanticUtil.getUltimateType(type, false);
|
||||
assertInstance(type, IBasicType.class);
|
||||
assertEquals("int", ASTTypeUtil.getType(type));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addTests(TestSuite suite) {
|
||||
|
@ -234,6 +118,64 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
setStrategy(new ReferencedProject(true));
|
||||
}
|
||||
|
||||
// template<typename _TpAllocator>
|
||||
// class Allocator {
|
||||
// public:
|
||||
// typedef _TpAllocator& alloc_reference;
|
||||
// template<typename _TpRebind>
|
||||
// struct rebind {
|
||||
// typedef Allocator<_TpRebind> other;
|
||||
// };
|
||||
// };
|
||||
//
|
||||
// template<typename _Tp, typename _Alloc = Allocator<_Tp> >
|
||||
// class Vec {
|
||||
// public:
|
||||
// typedef typename _Alloc::template rebind<_Tp>::other::alloc_reference reference;
|
||||
// };
|
||||
|
||||
// void f(Vec<int>::reference r) {}
|
||||
public void testRebindPattern_214017_1() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("r)", 1);
|
||||
assertInstance(b0, ICPPVariable.class);
|
||||
IType type = ((ICPPVariable) b0).getType();
|
||||
type = SemanticUtil.getUltimateType(type, false);
|
||||
assertInstance(type, IBasicType.class);
|
||||
assertEquals("int", ASTTypeUtil.getType(type));
|
||||
}
|
||||
|
||||
// template<typename _TpAllocator>
|
||||
// class Allocator {
|
||||
// public:
|
||||
// typedef _TpAllocator& alloc_reference;
|
||||
// template<typename _TpRebind>
|
||||
// struct rebind {
|
||||
// typedef Allocator<_TpRebind> other;
|
||||
// };
|
||||
// };
|
||||
//
|
||||
// template<typename _TpBase, typename _AllocBase>
|
||||
// class VecBase {
|
||||
// public:
|
||||
// typedef typename _AllocBase::template rebind<_TpBase>::other _Tp_alloc_type;
|
||||
// };
|
||||
//
|
||||
// template<typename _Tp, typename _Alloc = Allocator<_Tp> >
|
||||
// class Vec : protected VecBase<_Tp, _Alloc> {
|
||||
// public:
|
||||
// typedef typename VecBase<_Tp, _Alloc>::_Tp_alloc_type::alloc_reference reference;
|
||||
// };
|
||||
|
||||
// void f(Vec<int>::reference r) {}
|
||||
public void testRebindPattern_214017_2() throws Exception {
|
||||
IBinding b0= getBindingFromASTName("r)", 1);
|
||||
assertInstance(b0, ICPPVariable.class);
|
||||
IType type = ((ICPPVariable) b0).getType();
|
||||
type = SemanticUtil.getUltimateType(type, false);
|
||||
assertInstance(type, IBasicType.class);
|
||||
assertEquals("int", ASTTypeUtil.getType(type));
|
||||
}
|
||||
|
||||
// class Str1 {
|
||||
// public:
|
||||
// Str1(const char* s) {
|
||||
|
@ -1112,7 +1054,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
//
|
||||
// A<B> ab;
|
||||
// A<C> ac;
|
||||
public void _testEnclosingScopes_a() throws Exception {
|
||||
public void testEnclosingScopes_a() throws Exception {
|
||||
ICPPSpecialization b0= getBindingFromASTName("A<B>", 4, ICPPSpecialization.class, ICPPClassType.class);
|
||||
ICPPTemplateInstance b1= getBindingFromASTName("A<C>", 4, ICPPTemplateInstance.class, ICPPClassType.class);
|
||||
|
||||
|
@ -1194,9 +1136,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// };
|
||||
|
||||
// X<A>::Y::Z xayz;
|
||||
public void _testEnclosingScopes_c() throws Exception {
|
||||
fakeFailForSingle();
|
||||
|
||||
public void testEnclosingScopes_c() throws Exception {
|
||||
ICPPClassType b0= getBindingFromASTName("Y::Z x", 1, ICPPClassType.class);
|
||||
ICPPClassType b1= getBindingFromASTName("Z xayz", 1, ICPPClassType.class);
|
||||
|
||||
|
@ -1223,7 +1163,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// };
|
||||
|
||||
// X<B,A>::N n;
|
||||
public void _testEnclosingScopes_d() throws Exception {
|
||||
public void testEnclosingScopes_d() throws Exception {
|
||||
ICPPClassType b0= getBindingFromASTName("N n", 1, ICPPClassType.class, ICPPSpecialization.class);
|
||||
ICPPClassType b1= assertInstance(((ICPPSpecialization) b0).getSpecializedBinding(), ICPPClassType.class);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public abstract class CompositeScope implements IIndexScope {
|
|||
this.rbinding = rbinding;
|
||||
}
|
||||
|
||||
final public IIndexScope getParent() {
|
||||
public IIndexScope getParent() {
|
||||
IIndexScope rscope = rbinding.getScope();
|
||||
if(rscope!=null) {
|
||||
return cf.getCompositeScope(rscope);
|
||||
|
|
|
@ -194,7 +194,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
|||
}
|
||||
} else if (binding instanceof ICPPTemplateDefinition) {
|
||||
if (binding instanceof ICPPClassTemplatePartialSpecialization) {
|
||||
return new CompositeCPPClassTemplatePartialSpecialization(this, (ICPPClassTemplatePartialSpecialization) binding);
|
||||
return new CompositeCPPClassTemplatePartialSpecialization(this, (ICPPClassTemplatePartialSpecialization) findOneBinding(binding));
|
||||
} else if (binding instanceof ICPPClassType) {
|
||||
return new CompositeCPPClassTemplateSpecialization(this, (ICPPClassType) binding);
|
||||
} else if (binding instanceof ICPPConstructor) {
|
||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
|
|||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
|
@ -42,6 +43,11 @@ public class CompositeCPPClassInstance extends CompositeCPPClassType
|
|||
return bindings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScope getCompositeScope() throws DOMException {
|
||||
return new CompositeCPPClassSpecializationScope(cf, rbinding);
|
||||
}
|
||||
|
||||
public ObjectMap getArgumentMap() { return TemplateInstanceUtil.getArgumentMap(cf, rbinding); }
|
||||
public IBinding getSpecializedBinding() { return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding); }
|
||||
public IType[] getArguments() { return TemplateInstanceUtil.getArguments(cf, (ICPPTemplateInstance) rbinding); }
|
||||
|
|
|
@ -26,14 +26,11 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassScope;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositingNotImplementedError;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class CompositeCPPClassSpecializationScope extends CompositeCPPClassScope {
|
||||
|
||||
private ObjectMap instanceMap = ObjectMap.EMPTY_MAP;
|
||||
|
||||
public CompositeCPPClassSpecializationScope(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
|
||||
super(cf, rbinding);
|
||||
}
|
||||
|
@ -44,12 +41,13 @@ public class CompositeCPPClassSpecializationScope extends CompositeCPPClassScope
|
|||
|
||||
@Override
|
||||
public ICPPMethod[] getImplicitMethods() {
|
||||
throw new CompositingNotImplementedError();
|
||||
// Implicit methods shouldn't have implicit specializations
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
throw new CompositingNotImplementedError();
|
||||
return CPPSemantics.findBindings(this, name, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,8 +75,28 @@ public class CompositeCPPClassSpecializationScope extends CompositeCPPClassScope
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet acceptLocalBindings) throws DOMException {
|
||||
throw new CompositingNotImplementedError();
|
||||
public IBinding[] getBindings(IASTName name, boolean forceResolve, boolean prefixLookup,
|
||||
IIndexFileSet fileSet) throws DOMException {
|
||||
char[] c = name.toCharArray();
|
||||
IBinding[] result = null;
|
||||
|
||||
if ((!prefixLookup && CharArrayUtils.equals(c, specialization().getNameCharArray())) ||
|
||||
(prefixLookup && CharArrayUtils.equals(specialization().getNameCharArray(), 0, c.length, c, true))) {
|
||||
result = new IBinding[] { specialization() };
|
||||
}
|
||||
|
||||
ICPPClassType specialized = (ICPPClassType) specialization().getSpecializedBinding();
|
||||
IScope classScope = specialized.getCompositeScope();
|
||||
IBinding[] bindings = classScope != null ?
|
||||
classScope.getBindings(name, forceResolve, prefixLookup, fileSet) : null;
|
||||
|
||||
if (bindings != null) {
|
||||
for (int i = 0; i < bindings.length; i++) {
|
||||
result = (IBinding[]) ArrayUtil.append(IBinding.class, result, getInstance(bindings[i]));
|
||||
}
|
||||
}
|
||||
|
||||
return (IBinding[]) ArrayUtil.trim(IBinding.class, result);
|
||||
}
|
||||
|
||||
private IBinding getInstance(IBinding binding) {
|
||||
|
@ -93,6 +111,4 @@ public class CompositeCPPClassSpecializationScope extends CompositeCPPClassScope
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ObjectMap instanceMap = ObjectMap.EMPTY_MAP;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
class CompositeCPPNamespaceAlias extends CompositeCPPBinding implements ICPPNamespaceAlias {
|
||||
|
@ -23,11 +24,15 @@ class CompositeCPPNamespaceAlias extends CompositeCPPBinding implements ICPPName
|
|||
}
|
||||
|
||||
public IBinding[] getMemberBindings() throws DOMException {
|
||||
fail(); return null;
|
||||
IBinding[] result= ((ICPPNamespaceAlias)rbinding).getMemberBindings();
|
||||
for(int i=0; i<result.length; i++) {
|
||||
result[i]= cf.getCompositeBinding((IIndexFragmentBinding)result[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ICPPNamespaceScope getNamespaceScope() throws DOMException {
|
||||
fail(); return null;
|
||||
return (ICPPNamespaceScope) cf.getCompositeScope((IIndexScope) ((ICPPNamespaceAlias)rbinding).getNamespaceScope());
|
||||
}
|
||||
|
||||
public IBinding getBinding() {
|
||||
|
|
|
@ -18,13 +18,14 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
|
|||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
||||
import org.eclipse.cdt.internal.core.index.composite.CompositeScope;
|
||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||
|
||||
public class CompositeCPPTemplateScope extends CompositeScope implements ICPPTemplateScope {
|
||||
public CompositeCPPTemplateScope(ICompositesFactory cf,
|
||||
ICPPTemplateScope rbinding) {
|
||||
super(cf, (IIndexFragmentBinding) rbinding);
|
||||
super(cf, (IIndexFragmentBinding) ((IIndexScope)rbinding).getScopeBinding());
|
||||
}
|
||||
|
||||
public ICPPTemplateDefinition getTemplateDefinition() throws DOMException {
|
||||
|
@ -50,4 +51,9 @@ public class CompositeCPPTemplateScope extends CompositeScope implements ICPPTem
|
|||
public IIndexBinding getScopeBinding() {
|
||||
return cf.getCompositeBinding(rbinding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndexScope getParent() {
|
||||
return (IIndexScope) rbinding;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,13 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
|
|||
return null;
|
||||
}
|
||||
|
||||
public final IIndexScope getScope() {
|
||||
/*
|
||||
* Most of the time, the parent node in the binding hierarchy is also the scope. For
|
||||
* some template bindings, this does not hold.
|
||||
*
|
||||
* @see org.eclipse.cdt.internal.core.index.IIndexFragmentBinding#getScope()
|
||||
*/
|
||||
public IIndexScope getScope() {
|
||||
try {
|
||||
IBinding parent = getParentBinding();
|
||||
if (parent instanceof IIndexScope) {
|
||||
|
@ -224,8 +230,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
|
|||
@Override
|
||||
abstract protected int getRecordSize(); // superclass's implementation is no longer valid
|
||||
|
||||
/* For debug purposes only
|
||||
* (non-Javadoc)
|
||||
/* For debug purposes only.
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -296,4 +297,18 @@ class PDOMCPPClassInstance extends PDOMCPPInstance implements
|
|||
PDOMNodeLinkedList list = new PDOMNodeLinkedList(pdom, record + MEMBERLIST, getLinkageImpl());
|
||||
list.accept(visitor);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final IIndexScope getScope() {
|
||||
try {
|
||||
IScope scope= getSpecializedBinding().getScope();
|
||||
if(scope instanceof IIndexScope) {
|
||||
return (IIndexScope) scope;
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
|
|||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||
import org.eclipse.cdt.core.index.IIndexName;
|
||||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
|
@ -144,15 +143,6 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
public ICPPTemplateDefinition getTemplateDefinition() throws DOMException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
// this is actually wrong, the undeclared bindings should be filtered out. However, that causes
|
||||
// some of the test cases to fail. --> need to look into this.
|
||||
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=227967
|
||||
protected IndexFilter getFilterForBindingsOfScope() {
|
||||
return IndexFilter.ALL;
|
||||
}
|
||||
|
||||
private class PDOMCPPTemplateScope implements ICPPTemplateScope, IIndexScope {
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
|
@ -197,7 +187,7 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
}
|
||||
|
||||
public IIndexScope getParent() {
|
||||
return PDOMCPPClassTemplate.super.getParent();
|
||||
return PDOMCPPClassTemplate.this.getParent();
|
||||
}
|
||||
|
||||
public ICPPTemplateDefinition getTemplateDefinition()
|
||||
|
@ -217,7 +207,7 @@ class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
private PDOMCPPTemplateScope scope;
|
||||
|
||||
@Override
|
||||
public IIndexScope getParent() {
|
||||
public IIndexScope getScope() {
|
||||
if (scope == null) {
|
||||
scope = new PDOMCPPTemplateScope();
|
||||
}
|
||||
|
|
|
@ -673,6 +673,14 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (scope instanceof ICPPTemplateScope &&
|
||||
!(binding instanceof ICPPTemplateParameter || binding instanceof ICPPTemplateInstance)) {
|
||||
scope = scope.getParent();
|
||||
if (scope == null) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
if (scope instanceof IIndexScope) {
|
||||
if (scope instanceof CompositeScope) { // we special case for performance
|
||||
return adaptOrAddBinding(add, ((CompositeScope) scope).getRawScopeBinding());
|
||||
|
@ -681,14 +689,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
}
|
||||
|
||||
// the scope is from the ast
|
||||
if (scope instanceof ICPPTemplateScope &&
|
||||
!(binding instanceof ICPPTemplateParameter || binding instanceof ICPPTemplateInstance)) {
|
||||
scope = scope.getParent();
|
||||
if (scope == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
while (scope instanceof ICPPNamespaceScope) {
|
||||
IName name= scope.getScopeName();
|
||||
if (name != null && name.toCharArray().length == 0) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -19,11 +20,14 @@ import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
|||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
||||
import org.eclipse.cdt.internal.core.index.IndexCPPSignatureUtil;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList;
|
||||
|
@ -188,4 +192,24 @@ abstract class PDOMCPPSpecialization extends PDOMCPPBinding implements
|
|||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndexScope getScope() {
|
||||
try {
|
||||
IBinding parent= getParentBinding();
|
||||
if(parent instanceof ICPPSpecialization && parent instanceof ICPPClassType) {
|
||||
return (IIndexScope) ((ICPPClassType) parent).getCompositeScope();
|
||||
} else {
|
||||
IScope scope= getSpecializedBinding().getScope();
|
||||
if(scope instanceof IIndexScope) {
|
||||
return (IIndexScope) scope;
|
||||
}
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
CCorePlugin.log(de);
|
||||
} catch(CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue