mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
Bug 408314 - Failure of dependent base lookup
Change-Id: Ib90cc5e562c459bdd15741655b35c599ad9ac297 Reviewed-on: https://git.eclipse.org/r/12959 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
8af6460cc0
commit
96e51dfbca
12 changed files with 105 additions and 110 deletions
|
@ -13,6 +13,7 @@
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* Thomas Corbat (IFS)
|
* Thomas Corbat (IFS)
|
||||||
* Nathan Ridge
|
* Nathan Ridge
|
||||||
|
* Danny Ferreira
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
|
@ -1968,7 +1969,8 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
ITypedef myType = (ITypedef) col.getName(31).resolveBinding();
|
ITypedef myType = (ITypedef) col.getName(31).resolveBinding();
|
||||||
ICPPClassType A = (ICPPClassType) myType.getType();
|
ICPPClassType A = (ICPPClassType) myType.getType();
|
||||||
|
|
||||||
ICPPSpecialization Aspec = (ICPPSpecialization) col.getName(10).resolveBinding();
|
ICPPClassTemplatePartialSpecialization Aspec =
|
||||||
|
(ICPPClassTemplatePartialSpecialization) col.getName(10).resolveBinding();
|
||||||
|
|
||||||
assertTrue(A instanceof ICPPTemplateInstance);
|
assertTrue(A instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)A).getTemplateDefinition(), Aspec);
|
assertSame(((ICPPTemplateInstance)A).getTemplateDefinition(), Aspec);
|
||||||
|
@ -3225,6 +3227,66 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
ba.assertNonProblem("foo(s", 3);
|
ba.assertNonProblem("foo(s", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<typename U>
|
||||||
|
// struct result : U {
|
||||||
|
// typedef typename result::result_type type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct B {
|
||||||
|
// typedef int result_type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// typedef result<B>::type waldo;
|
||||||
|
public void testDependentBaseLookup_408314a() throws Exception {
|
||||||
|
BindingAssertionHelper bh = getAssertionHelper();
|
||||||
|
ITypedef waldo = bh.assertNonProblem("waldo");
|
||||||
|
assertSameType(waldo.getType(), CommonTypes.int_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <typename T>
|
||||||
|
// struct A {
|
||||||
|
// template <typename U>
|
||||||
|
// struct result;
|
||||||
|
//
|
||||||
|
// template <typename V>
|
||||||
|
// struct result<V*> : T {
|
||||||
|
// typedef typename result::result_type type;
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct B {
|
||||||
|
// typedef int result_type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// typedef A<B>::result<int*>::type waldo;
|
||||||
|
public void testDependentBaseLookup_408314b() throws Exception {
|
||||||
|
BindingAssertionHelper bh = getAssertionHelper();
|
||||||
|
ITypedef waldo = bh.assertNonProblem("waldo");
|
||||||
|
assertSameType(waldo.getType(), CommonTypes.int_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <typename T>
|
||||||
|
// struct A {
|
||||||
|
// template <typename U>
|
||||||
|
// struct result;
|
||||||
|
//
|
||||||
|
// template <typename V>
|
||||||
|
// struct result<V*> : T {
|
||||||
|
// typedef typename result::result_type type;
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct B {
|
||||||
|
// typedef int result_type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// typedef A<B>::result<B*>::type waldo;
|
||||||
|
public void testDependentBaseLookup_408314c() throws Exception {
|
||||||
|
BindingAssertionHelper bh = getAssertionHelper();
|
||||||
|
ITypedef waldo = bh.assertNonProblem("waldo");
|
||||||
|
assertSameType(waldo.getType(), CommonTypes.int_);
|
||||||
|
}
|
||||||
|
|
||||||
// template <class T>
|
// template <class T>
|
||||||
// class A {
|
// class A {
|
||||||
// public:
|
// public:
|
||||||
|
|
|
@ -599,17 +599,14 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
IBinding b3= getBindingFromASTName("D<B", 1);
|
IBinding b3= getBindingFromASTName("D<B", 1);
|
||||||
|
|
||||||
List spBindings= new ArrayList();
|
List spBindings= new ArrayList();
|
||||||
assertInstance(b0, ICPPSpecialization.class);
|
assertInstance(b0, ICPPClassTemplatePartialSpecialization.class);
|
||||||
assertInstance(b0, ICPPClassTemplate.class);
|
spBindings.add(((ICPPClassTemplatePartialSpecialization)b0).getPrimaryClassTemplate());
|
||||||
spBindings.add(((ICPPSpecialization)b0).getSpecializedBinding());
|
|
||||||
|
|
||||||
assertInstance(b1, ICPPSpecialization.class);
|
assertInstance(b1, ICPPClassTemplatePartialSpecialization.class);
|
||||||
assertInstance(b1, ICPPClassTemplate.class);
|
spBindings.add(((ICPPClassTemplatePartialSpecialization)b1).getPrimaryClassTemplate());
|
||||||
spBindings.add(((ICPPSpecialization)b1).getSpecializedBinding());
|
|
||||||
|
|
||||||
assertInstance(b2, ICPPSpecialization.class);
|
assertInstance(b2, ICPPClassTemplatePartialSpecialization.class);
|
||||||
assertInstance(b2, ICPPClassTemplate.class);
|
spBindings.add(((ICPPClassTemplatePartialSpecialization)b2).getPrimaryClassTemplate());
|
||||||
spBindings.add(((ICPPSpecialization)b2).getSpecializedBinding());
|
|
||||||
|
|
||||||
for(int i=0; i<spBindings.size(); i++) {
|
for(int i=0; i<spBindings.size(); i++) {
|
||||||
for(int j=0; j<spBindings.size(); j++) {
|
for(int j=0; j<spBindings.size(); j++) {
|
||||||
|
|
|
@ -13,25 +13,21 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
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.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A partial class template specialization.
|
* A partial class template specialization.
|
||||||
*/
|
*/
|
||||||
public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate
|
public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate
|
||||||
implements ICPPClassTemplatePartialSpecialization, ICPPSpecialization {
|
implements ICPPClassTemplatePartialSpecialization {
|
||||||
|
|
||||||
private final ICPPTemplateArgument[] arguments;
|
private final ICPPTemplateArgument[] arguments;
|
||||||
|
|
||||||
|
@ -54,27 +50,11 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate
|
||||||
return (ICPPClassTemplate) id.getTemplateName().resolveBinding();
|
return (ICPPClassTemplate) id.getTemplateName().resolveBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinding getSpecializedBinding() {
|
|
||||||
return getPrimaryClassTemplate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ICPPTemplateParameterMap getTemplateParameterMap() {
|
|
||||||
return CPPTemplates.createParameterMap(getPrimaryClassTemplate(), getTemplateArguments());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + ASTTypeUtil.getArgumentListString(getTemplateArguments(), true);
|
return super.toString() + ASTTypeUtil.getArgumentListString(getTemplateArguments(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public ObjectMap getArgumentMap() {
|
|
||||||
return CPPTemplates.getArgumentMap(getPrimaryClassTemplate(), getTemplateParameterMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public IType[] getArguments() throws DOMException {
|
public IType[] getArguments() throws DOMException {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
|
@ -47,8 +48,9 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
|
||||||
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
|
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
|
||||||
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
|
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
|
||||||
ICPPClassTemplatePartialSpecialization[] spec = new ICPPClassTemplatePartialSpecialization[orig.length];
|
ICPPClassTemplatePartialSpecialization[] spec = new ICPPClassTemplatePartialSpecialization[orig.length];
|
||||||
|
ICPPClassSpecialization owner = (ICPPClassSpecialization) getOwner();
|
||||||
for (int i = 0; i < orig.length; i++) {
|
for (int i = 0; i < orig.length; i++) {
|
||||||
spec[i]= (ICPPClassTemplatePartialSpecialization) specializeMember(orig[i], point);
|
spec[i]= (ICPPClassTemplatePartialSpecialization) owner.specializeMember(orig[i], point);
|
||||||
}
|
}
|
||||||
fPartialSpecs = spec;
|
fPartialSpecs = spec;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,12 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableType;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPUnknownField;
|
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPUnknownField;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPUnknownMemberClass;
|
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPUnknownMemberClass;
|
||||||
|
@ -32,6 +34,9 @@ public class CPPUnknownMember extends CPPUnknownBinding implements ICPPUnknownMe
|
||||||
|
|
||||||
protected CPPUnknownMember(IType owner, char[] name) {
|
protected CPPUnknownMember(IType owner, char[] name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
if (owner instanceof ICPPClassTemplate) {
|
||||||
|
owner= CPPTemplates.createDeferredInstance((ICPPClassTemplate) owner);
|
||||||
|
}
|
||||||
fOwner= owner;
|
fOwner= owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2638,15 +2638,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
IBinding inst= null;
|
IBinding inst= instantiate(classTemplate, newArgs, point);
|
||||||
if (classTemplate instanceof ICPPClassTemplatePartialSpecialization) {
|
|
||||||
try {
|
|
||||||
inst= instantiatePartialSpecialization((ICPPClassTemplatePartialSpecialization) classTemplate, newArgs, false, null, point);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
inst= instantiate(classTemplate, newArgs, point);
|
|
||||||
}
|
|
||||||
if (inst != null)
|
if (inst != null)
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,9 +518,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
}
|
}
|
||||||
} else if (binding instanceof ICPPTemplateDefinition) {
|
} else if (binding instanceof ICPPTemplateDefinition) {
|
||||||
if (binding instanceof ICPPClassTemplatePartialSpecialization) {
|
if (binding instanceof ICPPClassTemplatePartialSpecialization) {
|
||||||
if (binding instanceof ICPPClassTemplatePartialSpecializationSpecialization)
|
return new CompositeCPPClassTemplatePartialSpecializationSpecialization(this, (ICPPClassTemplatePartialSpecializationSpecialization) binding);
|
||||||
return new CompositeCPPClassTemplatePartialSpecializationSpecialization(this, (ICPPClassTemplatePartialSpecializationSpecialization) binding);
|
|
||||||
return new CompositeCPPClassTemplatePartialSpecialization(this, (ICPPClassTemplatePartialSpecialization) findOneBinding(binding));
|
|
||||||
} else if (binding instanceof ICPPClassType) {
|
} else if (binding instanceof ICPPClassType) {
|
||||||
return new CompositeCPPClassTemplateSpecialization(this, (ICPPClassType) binding);
|
return new CompositeCPPClassTemplateSpecialization(this, (ICPPClassType) binding);
|
||||||
} else if (binding instanceof ICPPConstructor) {
|
} else if (binding instanceof ICPPConstructor) {
|
||||||
|
@ -557,6 +555,8 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
throw new CompositingNotImplementedError("Composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (binding instanceof ICPPClassTemplatePartialSpecialization) {
|
||||||
|
return new CompositeCPPClassTemplatePartialSpecialization(this, (ICPPClassTemplatePartialSpecialization) findOneBinding(binding));
|
||||||
} else if (binding instanceof ICPPTemplateParameter) {
|
} else if (binding instanceof ICPPTemplateParameter) {
|
||||||
if (binding instanceof ICPPTemplateTypeParameter) {
|
if (binding instanceof ICPPTemplateTypeParameter) {
|
||||||
result = new CompositeCPPTemplateTypeParameter(this, (ICPPTemplateTypeParameter) binding);
|
result = new CompositeCPPTemplateTypeParameter(this, (ICPPTemplateTypeParameter) binding);
|
||||||
|
|
|
@ -11,21 +11,16 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
package org.eclipse.cdt.internal.core.index.composite.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
|
||||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateParameterMap;
|
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMOverloader;
|
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMOverloader;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public class CompositeCPPClassTemplatePartialSpecialization extends CompositeCPPClassTemplate implements ICPPClassTemplatePartialSpecialization, ICPPSpecialization, IPDOMOverloader {
|
public class CompositeCPPClassTemplatePartialSpecialization extends CompositeCPPClassTemplate implements ICPPClassTemplatePartialSpecialization, IPDOMOverloader {
|
||||||
public CompositeCPPClassTemplatePartialSpecialization(ICompositesFactory cf, ICPPClassTemplatePartialSpecialization delegate) {
|
public CompositeCPPClassTemplatePartialSpecialization(ICompositesFactory cf, ICPPClassTemplatePartialSpecialization delegate) {
|
||||||
super(cf, delegate);
|
super(cf, delegate);
|
||||||
}
|
}
|
||||||
|
@ -36,36 +31,16 @@ public class CompositeCPPClassTemplatePartialSpecialization extends CompositeCPP
|
||||||
return (ICPPClassTemplate) cf.getCompositeBinding((IIndexFragmentBinding)preresult);
|
return (ICPPClassTemplate) cf.getCompositeBinding((IIndexFragmentBinding)preresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinding getSpecializedBinding() {
|
|
||||||
return TemplateInstanceUtil.getSpecializedBinding(cf, rbinding);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSignatureHash() throws CoreException {
|
public int getSignatureHash() throws CoreException {
|
||||||
return ((IPDOMOverloader) rbinding).getSignatureHash();
|
return ((IPDOMOverloader) rbinding).getSignatureHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ICPPTemplateParameterMap getTemplateParameterMap() {
|
|
||||||
IBinding owner= getOwner();
|
|
||||||
if (owner instanceof ICPPSpecialization) {
|
|
||||||
return ((ICPPSpecialization) owner).getTemplateParameterMap();
|
|
||||||
}
|
|
||||||
return CPPTemplateParameterMap.EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPTemplateArgument[] getTemplateArguments() {
|
public ICPPTemplateArgument[] getTemplateArguments() {
|
||||||
return TemplateInstanceUtil.getTemplateArguments(cf, (ICPPClassTemplatePartialSpecialization) rbinding);
|
return TemplateInstanceUtil.getTemplateArguments(cf, (ICPPClassTemplatePartialSpecialization) rbinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public ObjectMap getArgumentMap() {
|
|
||||||
return TemplateInstanceUtil.getArgumentMap(cf, rbinding);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public IType[] getArguments() {
|
public IType[] getArguments() {
|
||||||
|
|
|
@ -13,16 +13,11 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
|
||||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
|
||||||
import org.eclipse.cdt.internal.core.Util;
|
import org.eclipse.cdt.internal.core.Util;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
|
@ -39,7 +34,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* Partial specialization of a class template for the index.
|
* Partial specialization of a class template for the index.
|
||||||
*/
|
*/
|
||||||
class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
|
class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
|
||||||
implements IPDOMPartialSpecialization, ICPPSpecialization, IPDOMOverloader {
|
implements IPDOMPartialSpecialization, IPDOMOverloader {
|
||||||
private static final int ARGUMENTS = PDOMCPPClassTemplate.RECORD_SIZE + 0;
|
private static final int ARGUMENTS = PDOMCPPClassTemplate.RECORD_SIZE + 0;
|
||||||
private static final int SIGNATURE_HASH = PDOMCPPClassTemplate.RECORD_SIZE + 4;
|
private static final int SIGNATURE_HASH = PDOMCPPClassTemplate.RECORD_SIZE + 4;
|
||||||
private static final int PRIMARY = PDOMCPPClassTemplate.RECORD_SIZE + 8;
|
private static final int PRIMARY = PDOMCPPClassTemplate.RECORD_SIZE + 8;
|
||||||
|
@ -107,11 +102,6 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinding getSpecializedBinding() {
|
|
||||||
return getPrimaryClassTemplate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setArguments(ICPPTemplateArgument[] templateArguments) throws CoreException {
|
public void setArguments(ICPPTemplateArgument[] templateArguments) throws CoreException {
|
||||||
final Database db = getPDOM().getDB();
|
final Database db = getPDOM().getDB();
|
||||||
|
@ -160,11 +150,6 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
|
||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ICPPTemplateParameterMap getTemplateParameterMap() {
|
|
||||||
return CPPTemplates.createParameterMap(getPrimaryClassTemplate(), getTemplateArguments());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSameType(IType type) {
|
public boolean isSameType(IType type) {
|
||||||
if (type instanceof ITypedef) {
|
if (type instanceof ITypedef) {
|
||||||
|
@ -185,17 +170,4 @@ class PDOMCPPClassTemplatePartialSpecialization extends PDOMCPPClassTemplate
|
||||||
final ICPPClassTemplatePartialSpecialization rhs = (ICPPClassTemplatePartialSpecialization)type;
|
final ICPPClassTemplatePartialSpecialization rhs = (ICPPClassTemplatePartialSpecialization)type;
|
||||||
return CPPClassTemplatePartialSpecialization.isSamePartialClassSpecialization(this, rhs);
|
return CPPClassTemplatePartialSpecialization.isSamePartialClassSpecialization(this, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public ObjectMap getArgumentMap() {
|
|
||||||
ICPPTemplateParameter[] params = getPrimaryClassTemplate().getTemplateParameters();
|
|
||||||
ICPPTemplateArgument[] args= getTemplateArguments();
|
|
||||||
int len= Math.min(params.length, args.length);
|
|
||||||
ObjectMap result= new ObjectMap(len);
|
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
result.put(params[i], args[i]);
|
|
||||||
}
|
|
||||||
return ObjectMap.EMPTY_MAP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ class PDOMCPPClassTemplatePartialSpecializationSpecialization extends PDOMCPPCla
|
||||||
public ICPPClassTemplate getPrimaryClassTemplate() {
|
public ICPPClassTemplate getPrimaryClassTemplate() {
|
||||||
if (fPrimaryTemplate == null) {
|
if (fPrimaryTemplate == null) {
|
||||||
try {
|
try {
|
||||||
int specializedRec = getDB().getInt(record + PRIMARY_TEMPLATE);
|
long specializedRec = getDB().getRecPtr(record + PRIMARY_TEMPLATE);
|
||||||
fPrimaryTemplate= (ICPPClassTemplate) getLinkage().getNode(specializedRec);
|
fPrimaryTemplate= (ICPPClassTemplate) getLinkage().getNode(specializedRec);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
|
|
|
@ -161,8 +161,9 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
|
||||||
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
|
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
|
||||||
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
|
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
|
||||||
ICPPClassTemplatePartialSpecialization[] spec = new ICPPClassTemplatePartialSpecialization[orig.length];
|
ICPPClassTemplatePartialSpecialization[] spec = new ICPPClassTemplatePartialSpecialization[orig.length];
|
||||||
|
ICPPClassSpecialization owner = (ICPPClassSpecialization) getOwner();
|
||||||
for (int i = 0; i < orig.length; i++) {
|
for (int i = 0; i < orig.length; i++) {
|
||||||
spec[i]= (ICPPClassTemplatePartialSpecialization) specializeMember(orig[i], point);
|
spec[i]= (ICPPClassTemplatePartialSpecialization) owner.specializeMember(orig[i], point);
|
||||||
}
|
}
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecializationSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumeration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumeration;
|
||||||
|
@ -435,6 +434,13 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
pdomBinding = createSpecialization(parent, pdomSpecialized, binding);
|
pdomBinding = createSpecialization(parent, pdomSpecialized, binding);
|
||||||
|
} else if (binding instanceof ICPPClassTemplatePartialSpecialization) {
|
||||||
|
ICPPClassTemplate primary = ((ICPPClassTemplatePartialSpecialization) binding).getPrimaryClassTemplate();
|
||||||
|
PDOMBinding pdomPrimary = addBinding(primary, null);
|
||||||
|
if (pdomPrimary instanceof PDOMCPPClassTemplate) {
|
||||||
|
pdomBinding = new PDOMCPPClassTemplatePartialSpecialization(
|
||||||
|
this, parent, (ICPPClassTemplatePartialSpecialization) binding, (PDOMCPPClassTemplate) pdomPrimary);
|
||||||
|
}
|
||||||
} else if (binding instanceof ICPPField) {
|
} else if (binding instanceof ICPPField) {
|
||||||
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
|
||||||
pdomBinding = new PDOMCPPField(this, parent, (ICPPField) binding);
|
pdomBinding = new PDOMCPPField(this, parent, (ICPPField) binding);
|
||||||
|
@ -559,11 +565,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
} else if (special instanceof ICPPClassType && orig instanceof ICPPClassType) {
|
} else if (special instanceof ICPPClassType && orig instanceof ICPPClassType) {
|
||||||
result= new PDOMCPPClassInstance(this, parent, (ICPPClassType) special, orig);
|
result= new PDOMCPPClassInstance(this, parent, (ICPPClassType) special, orig);
|
||||||
}
|
}
|
||||||
} else if (special instanceof ICPPClassTemplatePartialSpecialization) {
|
|
||||||
if (orig instanceof PDOMCPPClassTemplate) {
|
|
||||||
result= new PDOMCPPClassTemplatePartialSpecialization(
|
|
||||||
this, parent, (ICPPClassTemplatePartialSpecialization) special, (PDOMCPPClassTemplate) orig);
|
|
||||||
}
|
|
||||||
} else if (special instanceof ICPPField) {
|
} else if (special instanceof ICPPField) {
|
||||||
result= new PDOMCPPFieldSpecialization(this, parent, (ICPPField) special, orig);
|
result= new PDOMCPPFieldSpecialization(this, parent, (ICPPField) special, orig);
|
||||||
} else if (special instanceof ICPPFunctionTemplate) {
|
} else if (special instanceof ICPPFunctionTemplate) {
|
||||||
|
@ -574,6 +575,14 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
} else if (special instanceof ICPPFunction) {
|
} else if (special instanceof ICPPFunction) {
|
||||||
result= new PDOMCPPFunctionTemplateSpecialization(this, parent, (ICPPFunctionTemplate) special, orig);
|
result= new PDOMCPPFunctionTemplateSpecialization(this, parent, (ICPPFunctionTemplate) special, orig);
|
||||||
}
|
}
|
||||||
|
} else if (special instanceof ICPPClassTemplatePartialSpecialization) {
|
||||||
|
ICPPClassTemplatePartialSpecialization partialSpecSpec = (ICPPClassTemplatePartialSpecialization) special;
|
||||||
|
ICPPClassTemplate primarySpec = partialSpecSpec.getPrimaryClassTemplate();
|
||||||
|
PDOMBinding pdomPrimarySpec = addBinding(primarySpec, null);
|
||||||
|
if (pdomPrimarySpec instanceof PDOMCPPClassTemplateSpecialization) {
|
||||||
|
result= new PDOMCPPClassTemplatePartialSpecializationSpecialization(this, parent, orig,
|
||||||
|
partialSpecSpec, (PDOMCPPClassTemplateSpecialization) pdomPrimarySpec);
|
||||||
|
}
|
||||||
} else if (special instanceof ICPPConstructor) {
|
} else if (special instanceof ICPPConstructor) {
|
||||||
result= new PDOMCPPConstructorSpecialization(this, parent, (ICPPConstructor) special, orig);
|
result= new PDOMCPPConstructorSpecialization(this, parent, (ICPPConstructor) special, orig);
|
||||||
} else if (special instanceof ICPPMethod) {
|
} else if (special instanceof ICPPMethod) {
|
||||||
|
@ -649,9 +658,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return CPP_CLASS_INSTANCE;
|
return CPP_CLASS_INSTANCE;
|
||||||
}
|
}
|
||||||
} else if (binding instanceof ICPPClassTemplatePartialSpecialization) {
|
} else if (binding instanceof ICPPClassTemplatePartialSpecialization) {
|
||||||
if (binding instanceof ICPPClassTemplatePartialSpecializationSpecialization)
|
return CPP_CLASS_TEMPLATE_PARTIAL_SPEC_SPEC;
|
||||||
return CPP_CLASS_TEMPLATE_PARTIAL_SPEC_SPEC;
|
|
||||||
return CPP_CLASS_TEMPLATE_PARTIAL_SPEC;
|
|
||||||
} else if (binding instanceof ICPPField) {
|
} else if (binding instanceof ICPPField) {
|
||||||
return CPP_FIELD_SPECIALIZATION;
|
return CPP_FIELD_SPECIALIZATION;
|
||||||
} else if (binding instanceof ICPPFunctionTemplate) {
|
} else if (binding instanceof ICPPFunctionTemplate) {
|
||||||
|
@ -675,6 +682,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
} else if (binding instanceof ITypedef) {
|
} else if (binding instanceof ITypedef) {
|
||||||
return CPP_TYPEDEF_SPECIALIZATION;
|
return CPP_TYPEDEF_SPECIALIZATION;
|
||||||
}
|
}
|
||||||
|
} else if (binding instanceof ICPPClassTemplatePartialSpecialization) {
|
||||||
|
return CPP_CLASS_TEMPLATE_PARTIAL_SPEC;
|
||||||
} else if (binding instanceof ICPPTemplateParameter) {
|
} else if (binding instanceof ICPPTemplateParameter) {
|
||||||
if (binding instanceof ICPPTemplateTypeParameter) {
|
if (binding instanceof ICPPTemplateTypeParameter) {
|
||||||
return CPP_TEMPLATE_TYPE_PARAMETER;
|
return CPP_TEMPLATE_TYPE_PARAMETER;
|
||||||
|
|
Loading…
Add table
Reference in a new issue