From 290cf3472d81bc8e27c4c763cd163af567c88f0f Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 24 Sep 2013 09:52:33 -0700 Subject: [PATCH] Bug 414450 - Fixed CompositingNotImplementedError for CPPAliasTemplateInstance. --- .../composite/cpp/CPPCompositesFactory.java | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java index 0c06e560c29..0a2dcc5e5e3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * 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.IValue; 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.ICPPClassScope; 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.IIndexMacroContainer; 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.CPPFunctionType; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameterPackType; @@ -123,7 +125,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory { if (rscope instanceof ICPPNamespaceScope) { ICPPNamespace[] namespaces; if (rscope instanceof CompositeCPPNamespace) { - // avoid duplicating the search + // Avoid duplicating the search. namespaces = ((CompositeCPPNamespace) rscope).namespaces; } else { namespaces = getNamespaces(rscope.getScopeBinding()); @@ -211,19 +213,26 @@ public class CPPCompositesFactory extends AbstractCompositeFactory { } 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) { - TypeOfDependentExpression tde= (TypeOfDependentExpression) rtype; - ICPPEvaluation e= tde.getEvaluation(); + TypeOfDependentExpression type= (TypeOfDependentExpression) rtype; + ICPPEvaluation e= type.getEvaluation(); ICPPEvaluation e2= getCompositeEvaluation(e); if (e != e2) return new TypeOfDependentExpression(e2); - return tde; + return type; } if (rtype instanceof ICPPUnaryTypeTransformation) { - ICPPUnaryTypeTransformation ttt= (ICPPUnaryTypeTransformation) rtype; - IType operand = ttt.getOperand(); - IType operand2 = getCompositeType(operand); - return new CPPUnaryTypeTransformation(ttt.getOperator(), operand2); + ICPPUnaryTypeTransformation typeTransformation= (ICPPUnaryTypeTransformation) rtype; + IType operand = getCompositeType(typeTransformation.getOperand()); + return new CPPUnaryTypeTransformation(typeTransformation.getOperator(), operand); } if (rtype instanceof IBasicType || rtype == null || rtype instanceof ISemanticProblem) { return rtype; @@ -646,11 +655,13 @@ public class CPPCompositesFactory extends AbstractCompositeFactory { final long i; final int j; final long k; + public Key(long id1, int id2, long id3) { i= id1; j= id2; k= id3; } + @Override public int hashCode() { final int prime = 31; @@ -660,6 +671,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory { result = prime * result + (int) k; return result; } + @Override public boolean equals(Object obj) { if (obj instanceof Key) {