1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-02 13:13:36 +02:00

Bug 414450 - Fixed CompositingNotImplementedError for

CPPAliasTemplateInstance.
This commit is contained in:
Sergey Prigogin 2013-09-24 09:52:33 -07:00
parent 8722849f10
commit 290cf3472d

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 Symbian Software Systems and others. * Copyright (c) 2007, 2013 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -24,6 +24,7 @@ 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.IValue; import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate; import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplateInstance;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
@ -59,6 +60,7 @@ import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexBinding; import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IIndexMacroContainer; import org.eclipse.cdt.core.index.IIndexMacroContainer;
import org.eclipse.cdt.internal.core.dom.parser.Value; import org.eclipse.cdt.internal.core.dom.parser.Value;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPAliasTemplateInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPArrayType; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPArrayType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameterPackType; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameterPackType;
@ -123,7 +125,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
if (rscope instanceof ICPPNamespaceScope) { if (rscope instanceof ICPPNamespaceScope) {
ICPPNamespace[] namespaces; ICPPNamespace[] namespaces;
if (rscope instanceof CompositeCPPNamespace) { if (rscope instanceof CompositeCPPNamespace) {
// avoid duplicating the search // Avoid duplicating the search.
namespaces = ((CompositeCPPNamespace) rscope).namespaces; namespaces = ((CompositeCPPNamespace) rscope).namespaces;
} else { } else {
namespaces = getNamespaces(rscope.getScopeBinding()); namespaces = getNamespaces(rscope.getScopeBinding());
@ -211,19 +213,26 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} }
return at; return at;
} }
if (rtype instanceof ICPPAliasTemplateInstance) {
ICPPAliasTemplateInstance instance = (ICPPAliasTemplateInstance) rtype;
ICPPAliasTemplate aliasTemplate = instance.getTemplateDefinition();
if (aliasTemplate instanceof IIndexFragmentBinding)
aliasTemplate = (ICPPAliasTemplate) getCompositeBinding((IIndexFragmentBinding) aliasTemplate);
IType aliasedType = getCompositeType(instance.getType());
return new CPPAliasTemplateInstance(instance.getNameCharArray(), aliasTemplate, aliasedType);
}
if (rtype instanceof TypeOfDependentExpression) { if (rtype instanceof TypeOfDependentExpression) {
TypeOfDependentExpression tde= (TypeOfDependentExpression) rtype; TypeOfDependentExpression type= (TypeOfDependentExpression) rtype;
ICPPEvaluation e= tde.getEvaluation(); ICPPEvaluation e= type.getEvaluation();
ICPPEvaluation e2= getCompositeEvaluation(e); ICPPEvaluation e2= getCompositeEvaluation(e);
if (e != e2) if (e != e2)
return new TypeOfDependentExpression(e2); return new TypeOfDependentExpression(e2);
return tde; return type;
} }
if (rtype instanceof ICPPUnaryTypeTransformation) { if (rtype instanceof ICPPUnaryTypeTransformation) {
ICPPUnaryTypeTransformation ttt= (ICPPUnaryTypeTransformation) rtype; ICPPUnaryTypeTransformation typeTransformation= (ICPPUnaryTypeTransformation) rtype;
IType operand = ttt.getOperand(); IType operand = getCompositeType(typeTransformation.getOperand());
IType operand2 = getCompositeType(operand); return new CPPUnaryTypeTransformation(typeTransformation.getOperator(), operand);
return new CPPUnaryTypeTransformation(ttt.getOperator(), operand2);
} }
if (rtype instanceof IBasicType || rtype == null || rtype instanceof ISemanticProblem) { if (rtype instanceof IBasicType || rtype == null || rtype instanceof ISemanticProblem) {
return rtype; return rtype;
@ -646,11 +655,13 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
final long i; final long i;
final int j; final int j;
final long k; final long k;
public Key(long id1, int id2, long id3) { public Key(long id1, int id2, long id3) {
i= id1; i= id1;
j= id2; j= id2;
k= id3; k= id3;
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
@ -660,6 +671,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
result = prime * result + (int) k; result = prime * result + (int) k;
return result; return result;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof Key) { if (obj instanceof Key) {