mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Bug 446711 - Name resolution problem with dependent enumeration
Handling of internal enumerator types during instantiation of an enumeration.
This commit is contained in:
parent
99bab29813
commit
8e5a31e714
26 changed files with 198 additions and 134 deletions
|
@ -7331,7 +7331,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// void test(B<int, 0>& p) {
|
// void test(B<int, 0>& p) {
|
||||||
// p.waldo();
|
// p.waldo();
|
||||||
// }
|
// }
|
||||||
public void _testDependentEnumeration_446711d() throws Exception {
|
public void testDependentEnumeration_446711d() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7347,7 +7347,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// template<typename T, T u, long v = A<T, u>::e2>
|
// template<typename T, T u, long v = A<T, u>::e2>
|
||||||
// struct B;
|
// struct B {};
|
||||||
//
|
//
|
||||||
// template<typename T, T u>
|
// template<typename T, T u>
|
||||||
// struct B<T, u, 0> {
|
// struct B<T, u, 0> {
|
||||||
|
@ -7357,7 +7357,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// void test(B<long, 0>& p) {
|
// void test(B<long, 0>& p) {
|
||||||
// p.waldo();
|
// p.waldo();
|
||||||
// }
|
// }
|
||||||
public void _testDependentEnumeration_446711e() throws Exception {
|
public void testDependentEnumeration_446711e() throws Exception {
|
||||||
BindingAssertionHelper helper = getAssertionHelper();
|
BindingAssertionHelper helper = getAssertionHelper();
|
||||||
helper.assertProblemOnFirstIdentifier(".waldo()");
|
helper.assertProblemOnFirstIdentifier(".waldo()");
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPClassSpecialization extends ICPPSpecialization, ICPPClassType {
|
public interface ICPPClassSpecialization extends ICPPTypeSpecialization, ICPPClassType {
|
||||||
@Override
|
@Override
|
||||||
ICPPClassType getSpecializedBinding();
|
ICPPClassType getSpecializedBinding();
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
/**
|
/**
|
||||||
* @since 5.5
|
* @since 5.5
|
||||||
*/
|
*/
|
||||||
public interface ICPPEnumerationSpecialization extends ICPPEnumeration, ICPPSpecialization {
|
public interface ICPPEnumerationSpecialization extends ICPPEnumeration, ICPPTypeSpecialization {
|
||||||
@Override
|
@Override
|
||||||
ICPPEnumeration getSpecializedBinding();
|
ICPPEnumeration getSpecializedBinding();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014 Google, Inc 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A common interface for ICPPClassSpecialization and ICPPEnumerationSpecialization.
|
||||||
|
*
|
||||||
|
* @since 5.9
|
||||||
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
|
*/
|
||||||
|
public interface ICPPTypeSpecialization extends ICPPSpecialization, IType {
|
||||||
|
}
|
|
@ -12,32 +12,80 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
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.IValue;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumeration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumerationSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumerationSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.ASTEnumerator;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binding for a specialization of an enumeration.
|
* Binding for a specialization of an enumeration.
|
||||||
*/
|
*/
|
||||||
public class CPPEnumerationSpecialization extends CPPSpecialization implements ICPPEnumerationSpecialization {
|
public class CPPEnumerationSpecialization extends CPPSpecialization implements ICPPEnumerationSpecialization {
|
||||||
private IEnumerator[] fEnumerators;
|
private final IEnumerator[] fEnumerators;
|
||||||
private final IType fFixedType;
|
private final IType fFixedType;
|
||||||
|
private boolean fInitializationComplete;
|
||||||
|
|
||||||
public CPPEnumerationSpecialization(ICPPEnumeration specialized, IBinding owner,
|
public static IBinding createInstance(ICPPEnumeration enumeration,
|
||||||
|
ICPPClassSpecialization owner, ICPPTemplateParameterMap tpMap, IASTNode point) {
|
||||||
|
ICPPClassSpecialization within = CPPTemplates.getSpecializationContext(owner);
|
||||||
|
IType fixedType = enumeration.getFixedType();
|
||||||
|
if (fixedType != null)
|
||||||
|
fixedType = CPPTemplates.instantiateType(fixedType, tpMap, -1, within, point);
|
||||||
|
CPPEnumerationSpecialization specializedEnumeration =
|
||||||
|
new CPPEnumerationSpecialization(enumeration, owner, tpMap, fixedType);
|
||||||
|
specializedEnumeration.initialize(point);
|
||||||
|
return specializedEnumeration;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CPPEnumerationSpecialization(ICPPEnumeration specialized, IBinding owner,
|
||||||
ICPPTemplateParameterMap argumentMap, IType fixedType) {
|
ICPPTemplateParameterMap argumentMap, IType fixedType) {
|
||||||
super(specialized, owner, argumentMap);
|
super(specialized, owner, argumentMap);
|
||||||
fFixedType = fixedType;
|
fFixedType = fixedType;
|
||||||
|
fEnumerators = new IEnumerator[specialized.getEnumerators().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnumerators(IEnumerator[] enumerators) {
|
private void initialize(IASTNode point) {
|
||||||
fEnumerators = enumerators;
|
ICPPTemplateParameterMap tpMap = getTemplateParameterMap();
|
||||||
|
IEnumerator[] enumerators = getSpecializedBinding().getEnumerators();
|
||||||
|
IType previousInternalType = CPPBasicType.INT;
|
||||||
|
for (int i = 0; i < enumerators.length; ++i) {
|
||||||
|
IEnumerator enumerator = enumerators[i];
|
||||||
|
IValue specializedValue = CPPTemplates.instantiateValue(enumerator.getValue(), tpMap, -1,
|
||||||
|
this, Value.MAX_RECURSION_DEPTH, point);
|
||||||
|
IType internalType = null;
|
||||||
|
if (fFixedType == null && enumerator instanceof ICPPInternalEnumerator) {
|
||||||
|
internalType = ((ICPPInternalEnumerator) enumerator).getInternalType();
|
||||||
|
if (internalType != null) {
|
||||||
|
internalType = CPPTemplates.instantiateType(internalType, tpMap, -1, this, point);
|
||||||
|
} else if (previousInternalType instanceof IBasicType) {
|
||||||
|
internalType = ASTEnumerator.getTypeOfIncrementedValue(
|
||||||
|
(IBasicType) previousInternalType, specializedValue);
|
||||||
|
}
|
||||||
|
if (internalType != null) {
|
||||||
|
previousInternalType = internalType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fEnumerators[i] = new CPPEnumeratorSpecialization(enumerator, this, tpMap, specializedValue,
|
||||||
|
internalType);
|
||||||
|
}
|
||||||
|
fInitializationComplete = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInitializing() {
|
||||||
|
return !fInitializationComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,8 +151,10 @@ public class CPPEnumerationSpecialization extends CPPSpecialization implements I
|
||||||
// The specialized enumerators are already computed, just need to look up the right one.
|
// The specialized enumerators are already computed, just need to look up the right one.
|
||||||
IEnumerator[] unspecializedEnumerators = getSpecializedBinding().getEnumerators();
|
IEnumerator[] unspecializedEnumerators = getSpecializedBinding().getEnumerators();
|
||||||
for (int i = 0; i < fEnumerators.length; ++i) {
|
for (int i = 0; i < fEnumerators.length; ++i) {
|
||||||
if (enumerator.equals(unspecializedEnumerators[i]))
|
if (enumerator.equals(unspecializedEnumerators[i])) {
|
||||||
return fEnumerators[i];
|
IEnumerator specializedEnumerator = fEnumerators[i];
|
||||||
|
return specializedEnumerator == null ? enumerator : specializedEnumerator;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return enumerator;
|
return enumerator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,14 @@ public class CPPEnumeratorSpecialization extends CPPSpecialization implements IC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IType getType() {
|
public IType getType() {
|
||||||
return getOwner();
|
ICPPEnumerationSpecialization owner = getOwner();
|
||||||
|
if (((CPPEnumerationSpecialization) owner).isInitializing()) {
|
||||||
|
// During enumeration instantiation enumerators can be referenced only by initializer
|
||||||
|
// expressions of other enumerators of the same enumeration. Return the internal type
|
||||||
|
// of the enumerator ([dcl.enum] 7.2-5).
|
||||||
|
return fInternalType;
|
||||||
|
}
|
||||||
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,8 +17,8 @@ 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.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPFunctionParameterMap;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPFunctionParameterMap;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public interface ICPPEvaluation extends ISerializableEvaluation {
|
||||||
* @return a fully or partially instantiated evaluation, or the original evaluation
|
* @return a fully or partially instantiated evaluation, or the original evaluation
|
||||||
*/
|
*/
|
||||||
ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point);
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keeps track of state during a constexpr evaluation.
|
* Keeps track of state during a constexpr evaluation.
|
||||||
|
|
|
@ -17,9 +17,9 @@ 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.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
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.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
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.ICPPEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -108,7 +108,7 @@ public abstract class CPPDependentEvaluation extends CPPEvaluation {
|
||||||
*/
|
*/
|
||||||
protected static ICPPEvaluation[] instantiateCommaSeparatedSubexpressions(
|
protected static ICPPEvaluation[] instantiateCommaSeparatedSubexpressions(
|
||||||
ICPPEvaluation[] subexpressions, ICPPTemplateParameterMap tpMap, int packOffset,
|
ICPPEvaluation[] subexpressions, ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation[] result = subexpressions;
|
ICPPEvaluation[] result = subexpressions;
|
||||||
int resultShift = 0;
|
int resultShift = 0;
|
||||||
for (int i = 0; i < subexpressions.length; i++) {
|
for (int i = 0; i < subexpressions.length; i++) {
|
||||||
|
@ -141,9 +141,9 @@ public abstract class CPPDependentEvaluation extends CPPEvaluation {
|
||||||
newEval = origEval.instantiate(tpMap, packOffset, within, maxdepth, point);
|
newEval = origEval.instantiate(tpMap, packOffset, within, maxdepth, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != subexpressions)
|
if (result != subexpressions) {
|
||||||
result[i + resultShift] = newEval;
|
result[i + resultShift] = newEval;
|
||||||
else if (newEval != origEval) {
|
} else if (newEval != origEval) {
|
||||||
assert resultShift == 0;
|
assert resultShift == 0;
|
||||||
result = new ICPPEvaluation[subexpressions.length];
|
result = new ICPPEvaluation[subexpressions.length];
|
||||||
System.arraycopy(subexpressions, 0, result, 0, i);
|
System.arraycopy(subexpressions, 0, result, 0, i);
|
||||||
|
|
|
@ -16,10 +16,10 @@ 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.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
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.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -47,7 +47,7 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static IBinding resolveUnknown(ICPPUnknownBinding unknown, ICPPTemplateParameterMap tpMap,
|
protected static IBinding resolveUnknown(ICPPUnknownBinding unknown, ICPPTemplateParameterMap tpMap,
|
||||||
int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
int packOffset, ICPPTypeSpecialization within, IASTNode point) {
|
||||||
try {
|
try {
|
||||||
return CPPTemplates.resolveUnknown(unknown, tpMap, packOffset, within, point);
|
return CPPTemplates.resolveUnknown(unknown, tpMap, packOffset, within, point);
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
|
@ -57,7 +57,7 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ICPPTemplateArgument[] instantiateArguments(ICPPTemplateArgument[] args,
|
protected static ICPPTemplateArgument[] instantiateArguments(ICPPTemplateArgument[] args,
|
||||||
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
ICPPTemplateParameterMap tpMap, int packOffset, ICPPTypeSpecialization within, IASTNode point) {
|
||||||
try {
|
try {
|
||||||
return CPPTemplates.instantiateArguments(args, tpMap, packOffset, within, point, false);
|
return CPPTemplates.instantiateArguments(args, tpMap, packOffset, within, point, false);
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
|
@ -66,8 +66,8 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static IBinding instantiateBinding(IBinding binding, ICPPTemplateParameterMap tpMap, int packOffset,
|
protected static IBinding instantiateBinding(IBinding binding, ICPPTemplateParameterMap tpMap,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
int packOffset, ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
try {
|
try {
|
||||||
return CPPTemplates.instantiateBinding(binding, tpMap, packOffset, within, maxdepth, point);
|
return CPPTemplates.instantiateBinding(binding, tpMap, packOffset, within, maxdepth, point);
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
|
|
|
@ -42,7 +42,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
|
@ -100,6 +99,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUnaryTypeTransformation;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUnaryTypeTransformation;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
|
@ -107,7 +107,6 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArraySet;
|
import org.eclipse.cdt.core.parser.util.CharArraySet;
|
||||||
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTEnumerator;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTInternalScope;
|
||||||
|
@ -118,7 +117,6 @@ import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPAliasTemplateInstance;
|
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.CPPBasicType;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassInstance;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassInstance;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassSpecialization;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassTemplatePartialSpecialization;
|
||||||
|
@ -130,7 +128,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPConstructorTemplateSpecia
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredClassInstance;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredFunction;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPDeferredFunction;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPEnumerationSpecialization;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPEnumerationSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPEnumeratorSpecialization;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFieldSpecialization;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFieldSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionInstance;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionInstance;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionSpecialization;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionSpecialization;
|
||||||
|
@ -164,7 +161,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInstanceCache;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalClassTemplate;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalClassTemplate;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalEnumerator;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownMember;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownMember;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownMemberClass;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownMemberClass;
|
||||||
|
@ -859,7 +855,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ICPPParameter[] specializeParameters(ICPPParameter[] parameters, ICPPFunction functionSpec,
|
public static ICPPParameter[] specializeParameters(ICPPParameter[] parameters, ICPPFunction functionSpec,
|
||||||
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, int maxdepth,
|
ICPPTemplateParameterMap tpMap, int packOffset, ICPPTypeSpecialization within, int maxdepth,
|
||||||
IASTNode point) {
|
IASTNode point) {
|
||||||
if (parameters.length == 0) {
|
if (parameters.length == 0) {
|
||||||
return parameters;
|
return parameters;
|
||||||
|
@ -962,7 +958,7 @@ public class CPPTemplates {
|
||||||
IType type= instantiateType(aliasTemplate.getType(), tpMap, -1, getSpecializationContext(owner), point);
|
IType type= instantiateType(aliasTemplate.getType(), tpMap, -1, getSpecializationContext(owner), point);
|
||||||
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), aliasTemplate, type);
|
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), aliasTemplate, type);
|
||||||
} else if (decl instanceof ICPPEnumeration) {
|
} else if (decl instanceof ICPPEnumeration) {
|
||||||
spec = instantiateEnumeration((ICPPEnumeration) decl, owner, tpMap, point);
|
spec = CPPEnumerationSpecialization.createInstance((ICPPEnumeration) decl, owner, tpMap, point);
|
||||||
} else if (decl instanceof IEnumerator) {
|
} else if (decl instanceof IEnumerator) {
|
||||||
IEnumerator enumerator = (IEnumerator) decl;
|
IEnumerator enumerator = (IEnumerator) decl;
|
||||||
ICPPEnumeration enumeration = (ICPPEnumeration) enumerator.getOwner();
|
ICPPEnumeration enumeration = (ICPPEnumeration) enumerator.getOwner();
|
||||||
|
@ -997,39 +993,9 @@ public class CPPTemplates {
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IBinding instantiateEnumeration(ICPPEnumeration enumeration, ICPPClassSpecialization owner,
|
public static ICPPClassSpecialization getSpecializationContext(IBinding owner) {
|
||||||
final ICPPTemplateParameterMap tpMap, IASTNode point) {
|
if (owner instanceof ICPPEnumerationSpecialization)
|
||||||
ICPPClassSpecialization within = getSpecializationContext(owner);
|
owner = owner.getOwner();
|
||||||
IType fixedType = instantiateType(enumeration.getFixedType(), tpMap, -1, within, point);
|
|
||||||
CPPEnumerationSpecialization specializedEnumeration =
|
|
||||||
new CPPEnumerationSpecialization(enumeration, owner, tpMap, fixedType);
|
|
||||||
IEnumerator[] enumerators = enumeration.getEnumerators();
|
|
||||||
IEnumerator[] specializedEnumerators = new IEnumerator[enumerators.length];
|
|
||||||
specializedEnumeration.setEnumerators(specializedEnumerators);
|
|
||||||
IType previousInternalType = CPPBasicType.INT;
|
|
||||||
for (int i = 0; i < enumerators.length; ++i) {
|
|
||||||
IEnumerator enumerator = enumerators[i];
|
|
||||||
IValue specializedValue =
|
|
||||||
instantiateValue(enumerator.getValue(), tpMap, -1, within, Value.MAX_RECURSION_DEPTH, point);
|
|
||||||
IType internalType = null;
|
|
||||||
if (fixedType == null && enumerator instanceof ICPPInternalEnumerator) {
|
|
||||||
internalType = ((ICPPInternalEnumerator) enumerator).getInternalType();
|
|
||||||
if (internalType != null) {
|
|
||||||
internalType = instantiateType(internalType, tpMap, -1, within, point);
|
|
||||||
} else if (previousInternalType instanceof IBasicType) {
|
|
||||||
internalType = ASTEnumerator.getTypeOfIncrementedValue((IBasicType) previousInternalType, specializedValue);
|
|
||||||
}
|
|
||||||
if (internalType != null) {
|
|
||||||
previousInternalType = internalType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
specializedEnumerators[i] = new CPPEnumeratorSpecialization(enumerator,
|
|
||||||
specializedEnumeration, tpMap, specializedValue, internalType);
|
|
||||||
}
|
|
||||||
return specializedEnumeration;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ICPPClassSpecialization getSpecializationContext(IBinding owner) {
|
|
||||||
if (!(owner instanceof ICPPClassSpecialization))
|
if (!(owner instanceof ICPPClassSpecialization))
|
||||||
return null;
|
return null;
|
||||||
ICPPClassSpecialization within= (ICPPClassSpecialization) owner;
|
ICPPClassSpecialization within= (ICPPClassSpecialization) owner;
|
||||||
|
@ -1048,7 +1014,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IValue instantiateValue(IValue value, ICPPTemplateParameterMap tpMap, int packOffset,
|
public static IValue instantiateValue(IValue value, ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return null;
|
return null;
|
||||||
ICPPEvaluation evaluation = value.getEvaluation();
|
ICPPEvaluation evaluation = value.getEvaluation();
|
||||||
|
@ -1166,7 +1132,7 @@ public class CPPTemplates {
|
||||||
* @return an array containing instantiated types.
|
* @return an array containing instantiated types.
|
||||||
*/
|
*/
|
||||||
public static IType[] instantiateTypes(IType[] types, ICPPTemplateParameterMap tpMap,
|
public static IType[] instantiateTypes(IType[] types, ICPPTemplateParameterMap tpMap,
|
||||||
int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
int packOffset, ICPPTypeSpecialization within, IASTNode point) {
|
||||||
if (types == null)
|
if (types == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -1218,7 +1184,7 @@ public class CPPTemplates {
|
||||||
* arguments.
|
* arguments.
|
||||||
*/
|
*/
|
||||||
public static ICPPTemplateArgument[] instantiateArguments(ICPPTemplateArgument[] args,
|
public static ICPPTemplateArgument[] instantiateArguments(ICPPTemplateArgument[] args,
|
||||||
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within,
|
ICPPTemplateParameterMap tpMap, int packOffset, ICPPTypeSpecialization within,
|
||||||
IASTNode point, boolean strict)
|
IASTNode point, boolean strict)
|
||||||
throws DOMException {
|
throws DOMException {
|
||||||
// Don't create a new array until it's really needed.
|
// Don't create a new array until it's really needed.
|
||||||
|
@ -1282,7 +1248,7 @@ public class CPPTemplates {
|
||||||
* Instantiates an argument
|
* Instantiates an argument
|
||||||
*/
|
*/
|
||||||
static ICPPTemplateArgument instantiateArgument(ICPPTemplateArgument arg,
|
static ICPPTemplateArgument instantiateArgument(ICPPTemplateArgument arg,
|
||||||
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
ICPPTemplateParameterMap tpMap, int packOffset, ICPPTypeSpecialization within, IASTNode point) {
|
||||||
if (arg == null)
|
if (arg == null)
|
||||||
return null;
|
return null;
|
||||||
if (arg.isNonTypeValue()) {
|
if (arg.isNonTypeValue()) {
|
||||||
|
@ -1301,7 +1267,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CPPTemplateParameterMap instantiateArgumentMap(ICPPTemplateParameterMap orig, ICPPTemplateParameterMap tpMap,
|
private static CPPTemplateParameterMap instantiateArgumentMap(ICPPTemplateParameterMap orig, ICPPTemplateParameterMap tpMap,
|
||||||
int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
int packOffset, ICPPTypeSpecialization within, IASTNode point) {
|
||||||
final Integer[] positions = orig.getAllParameterPositions();
|
final Integer[] positions = orig.getAllParameterPositions();
|
||||||
CPPTemplateParameterMap newMap= new CPPTemplateParameterMap(positions.length);
|
CPPTemplateParameterMap newMap= new CPPTemplateParameterMap(positions.length);
|
||||||
for (Integer key : positions) {
|
for (Integer key : positions) {
|
||||||
|
@ -1330,7 +1296,7 @@ public class CPPTemplates {
|
||||||
* The context is used to replace templates with their specialization, where appropriate.
|
* The context is used to replace templates with their specialization, where appropriate.
|
||||||
*/
|
*/
|
||||||
public static IType instantiateType(IType type, ICPPTemplateParameterMap tpMap, int packOffset,
|
public static IType instantiateType(IType type, ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, IASTNode point) {
|
ICPPTypeSpecialization within, IASTNode point) {
|
||||||
try {
|
try {
|
||||||
if (tpMap == null)
|
if (tpMap == null)
|
||||||
return type;
|
return type;
|
||||||
|
@ -1364,11 +1330,13 @@ public class CPPTemplates {
|
||||||
if (type instanceof ICPPUnknownBinding) {
|
if (type instanceof ICPPUnknownBinding) {
|
||||||
if (type instanceof TypeOfDependentExpression) {
|
if (type instanceof TypeOfDependentExpression) {
|
||||||
ICPPEvaluation eval = ((TypeOfDependentExpression) type).getEvaluation();
|
ICPPEvaluation eval = ((TypeOfDependentExpression) type).getEvaluation();
|
||||||
ICPPEvaluation instantiated = eval.instantiate(tpMap, packOffset, within, Value.MAX_RECURSION_DEPTH, point);
|
ICPPEvaluation instantiated = eval.instantiate(tpMap, packOffset, within,
|
||||||
|
Value.MAX_RECURSION_DEPTH, point);
|
||||||
if (instantiated != eval)
|
if (instantiated != eval)
|
||||||
return instantiated.getTypeOrFunctionSet(point);
|
return instantiated.getTypeOrFunctionSet(point);
|
||||||
} else {
|
} else {
|
||||||
IBinding binding= resolveUnknown((ICPPUnknownBinding) type, tpMap, packOffset, within, point);
|
IBinding binding= resolveUnknown((ICPPUnknownBinding) type, tpMap, packOffset,
|
||||||
|
within, point);
|
||||||
if (binding instanceof IType)
|
if (binding instanceof IType)
|
||||||
return (IType) binding;
|
return (IType) binding;
|
||||||
|
|
||||||
|
@ -1378,8 +1346,9 @@ public class CPPTemplates {
|
||||||
|
|
||||||
if (within != null && type instanceof IBinding) {
|
if (within != null && type instanceof IBinding) {
|
||||||
IType unwound= getNestedType(type, TDEF);
|
IType unwound= getNestedType(type, TDEF);
|
||||||
if (unwound instanceof ICPPClassType && unwound.isSameType(within.getSpecializedBinding())) {
|
if (unwound instanceof ICPPClassType && unwound.isSameType(getSpecializedType(within))) {
|
||||||
// Convert (partial) class-templates (specializations) to the more specialized version.
|
// Convert (partial) class-templates (specializations) to the more specialized
|
||||||
|
// version.
|
||||||
if (within instanceof ICPPClassTemplate || !(unwound instanceof ICPPClassTemplate))
|
if (within instanceof ICPPClassTemplate || !(unwound instanceof ICPPClassTemplate))
|
||||||
return within;
|
return within;
|
||||||
}
|
}
|
||||||
|
@ -1388,9 +1357,9 @@ public class CPPTemplates {
|
||||||
if (owner instanceof IType) {
|
if (owner instanceof IType) {
|
||||||
final IType ownerAsType = getNestedType((IType) owner, TDEF);
|
final IType ownerAsType = getNestedType((IType) owner, TDEF);
|
||||||
Object newOwner= owner;
|
Object newOwner= owner;
|
||||||
if (ownerAsType instanceof ICPPClassType && ownerAsType.isSameType(within.getSpecializedBinding())) {
|
if (ownerAsType instanceof ICPPClassType && ownerAsType.isSameType(getSpecializedType(within))) {
|
||||||
// Convert (partial) class-templates (specializations) that are used as owner of
|
// Convert (partial) class-templates (specializations) that are used as
|
||||||
// another binding, to the more specialized version.
|
// owner of another binding, to the more specialized version.
|
||||||
newOwner= within;
|
newOwner= within;
|
||||||
} else {
|
} else {
|
||||||
newOwner= instantiateType(ownerAsType, tpMap, packOffset, within, point);
|
newOwner= instantiateType(ownerAsType, tpMap, packOffset, within, point);
|
||||||
|
@ -1407,9 +1376,11 @@ public class CPPTemplates {
|
||||||
final IBinding origClass = classInstance.getSpecializedBinding();
|
final IBinding origClass = classInstance.getSpecializedBinding();
|
||||||
if (origClass instanceof ICPPClassType) {
|
if (origClass instanceof ICPPClassType) {
|
||||||
ICPPTemplateArgument[] args = classInstance.getTemplateArguments();
|
ICPPTemplateArgument[] args = classInstance.getTemplateArguments();
|
||||||
ICPPTemplateArgument[] newArgs = instantiateArguments(args, tpMap, packOffset, within, point, false);
|
ICPPTemplateArgument[] newArgs = instantiateArguments(args, tpMap, packOffset,
|
||||||
|
within, point, false);
|
||||||
if (newArgs != args) {
|
if (newArgs != args) {
|
||||||
CPPTemplateParameterMap tparMap = instantiateArgumentMap(classInstance.getTemplateParameterMap(), tpMap, packOffset, within, point);
|
CPPTemplateParameterMap tparMap = instantiateArgumentMap(classInstance.getTemplateParameterMap(),
|
||||||
|
tpMap, packOffset, within, point);
|
||||||
return new CPPClassInstance((ICPPClassType) origClass, classInstance.getOwner(), tparMap, args);
|
return new CPPClassInstance((ICPPClassType) origClass, classInstance.getOwner(), tparMap, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1466,6 +1437,10 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IType getSpecializedType(ICPPTypeSpecialization typeSpecialization) {
|
||||||
|
return (IType) typeSpecialization.getSpecializedBinding();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specialize a template parameter of a nested template by subtituting values for the template
|
* Specialize a template parameter of a nested template by subtituting values for the template
|
||||||
* parameters of enclosing templates into the template parameter's default value and, in the
|
* parameters of enclosing templates into the template parameter's default value and, in the
|
||||||
|
@ -1512,15 +1487,14 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IBinding instantiateBinding(IBinding binding, ICPPTemplateParameterMap tpMap, int packOffset,
|
public static IBinding instantiateBinding(IBinding binding, ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) throws DOMException {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) throws DOMException {
|
||||||
if (binding instanceof ICPPClassTemplate) {
|
if (binding instanceof ICPPClassTemplate) {
|
||||||
binding = createDeferredInstance((ICPPClassTemplate) binding);
|
binding = createDeferredInstance((ICPPClassTemplate) binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding instanceof ICPPUnknownBinding) {
|
if (binding instanceof ICPPUnknownBinding) {
|
||||||
return resolveUnknown((ICPPUnknownBinding) binding, tpMap, packOffset, within, point);
|
return resolveUnknown((ICPPUnknownBinding) binding, tpMap, packOffset, within, point);
|
||||||
} else if (binding instanceof IEnumerator
|
} else if (binding instanceof ICPPMethod
|
||||||
|| binding instanceof ICPPMethod
|
|
||||||
|| binding instanceof ICPPField
|
|| binding instanceof ICPPField
|
||||||
|| binding instanceof ICPPEnumeration
|
|| binding instanceof ICPPEnumeration
|
||||||
|| binding instanceof ICPPClassType) {
|
|| binding instanceof ICPPClassType) {
|
||||||
|
@ -1528,20 +1502,24 @@ public class CPPTemplates {
|
||||||
if (!(owner instanceof ICPPSpecialization)) {
|
if (!(owner instanceof ICPPSpecialization)) {
|
||||||
owner = instantiateBinding(owner, tpMap, packOffset, within, maxdepth, point);
|
owner = instantiateBinding(owner, tpMap, packOffset, within, maxdepth, point);
|
||||||
}
|
}
|
||||||
if (binding instanceof IEnumerator) {
|
|
||||||
if (owner instanceof ICPPEnumerationSpecialization) {
|
|
||||||
return ((ICPPEnumerationSpecialization) owner).specializeEnumerator((IEnumerator) binding);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (owner instanceof ICPPClassSpecialization) {
|
if (owner instanceof ICPPClassSpecialization) {
|
||||||
return ((ICPPClassSpecialization) owner).specializeMember(binding, point);
|
return ((ICPPClassSpecialization) owner).specializeMember(binding, point);
|
||||||
}
|
}
|
||||||
|
} else if (binding instanceof IEnumerator) {
|
||||||
|
IBinding owner = binding.getOwner();
|
||||||
|
if (within instanceof ICPPEnumerationSpecialization && within.getSpecializedBinding().equals(owner)) {
|
||||||
|
owner = within;
|
||||||
|
} else if (!(owner instanceof ICPPSpecialization)) {
|
||||||
|
owner = instantiateBinding(owner, tpMap, packOffset, within, maxdepth, point);
|
||||||
|
}
|
||||||
|
if (owner instanceof ICPPEnumerationSpecialization) {
|
||||||
|
return ((ICPPEnumerationSpecialization) owner).specializeEnumerator((IEnumerator) binding);
|
||||||
}
|
}
|
||||||
} else if (binding instanceof ICPPFunctionInstance) {
|
} else if (binding instanceof ICPPFunctionInstance) {
|
||||||
// TODO(nathanridge):
|
// TODO(nathanridge):
|
||||||
// Maybe we should introduce an ICPPDeferredFunctionInstance and have things that can return
|
// Maybe we should introduce an ICPPDeferredFunctionInstance and have things that can
|
||||||
// a dependent ICPPFunctionInstance (like instantiateForAddressOfFunction) return that when
|
// return a dependent ICPPFunctionInstance (like instantiateForAddressOfFunction)
|
||||||
// appropriate?
|
// return that when appropriate?
|
||||||
ICPPFunctionInstance origInstance = (ICPPFunctionInstance) binding;
|
ICPPFunctionInstance origInstance = (ICPPFunctionInstance) binding;
|
||||||
ICPPTemplateArgument[] origArgs = origInstance.getTemplateArguments();
|
ICPPTemplateArgument[] origArgs = origInstance.getTemplateArguments();
|
||||||
ICPPTemplateArgument[] newArgs = instantiateArguments(origArgs, tpMap, packOffset, within, point, false);
|
ICPPTemplateArgument[] newArgs = instantiateArguments(origArgs, tpMap, packOffset, within, point, false);
|
||||||
|
@ -2729,9 +2707,10 @@ public class CPPTemplates {
|
||||||
* Attempts to (partially) resolve an unknown binding with the given arguments.
|
* Attempts to (partially) resolve an unknown binding with the given arguments.
|
||||||
*/
|
*/
|
||||||
public static IBinding resolveUnknown(ICPPUnknownBinding unknown, ICPPTemplateParameterMap tpMap,
|
public static IBinding resolveUnknown(ICPPUnknownBinding unknown, ICPPTemplateParameterMap tpMap,
|
||||||
int packOffset, ICPPClassSpecialization within, IASTNode point) throws DOMException {
|
int packOffset, ICPPTypeSpecialization within, IASTNode point) throws DOMException {
|
||||||
if (unknown instanceof ICPPDeferredClassInstance) {
|
if (unknown instanceof ICPPDeferredClassInstance) {
|
||||||
return resolveDeferredClassInstance((ICPPDeferredClassInstance) unknown, tpMap, packOffset, within, point);
|
return resolveDeferredClassInstance((ICPPDeferredClassInstance) unknown, tpMap, packOffset,
|
||||||
|
within, point);
|
||||||
}
|
}
|
||||||
if (unknown instanceof ICPPUnknownMember) {
|
if (unknown instanceof ICPPUnknownMember) {
|
||||||
return resolveUnknownMember((ICPPUnknownMember) unknown, tpMap, packOffset, within, point);
|
return resolveUnknownMember((ICPPUnknownMember) unknown, tpMap, packOffset, within, point);
|
||||||
|
@ -2750,7 +2729,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IBinding resolveUnknownMember(ICPPUnknownMember unknown, ICPPTemplateParameterMap tpMap,
|
private static IBinding resolveUnknownMember(ICPPUnknownMember unknown, ICPPTemplateParameterMap tpMap,
|
||||||
int packOffset, ICPPClassSpecialization within, IASTNode point) throws DOMException {
|
int packOffset, ICPPTypeSpecialization within, IASTNode point) throws DOMException {
|
||||||
final IType ot0= unknown.getOwnerType();
|
final IType ot0= unknown.getOwnerType();
|
||||||
if (ot0 == null)
|
if (ot0 == null)
|
||||||
return unknown;
|
return unknown;
|
||||||
|
@ -2796,7 +2775,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IBinding resolveDeferredClassInstance(ICPPDeferredClassInstance dci,
|
private static IBinding resolveDeferredClassInstance(ICPPDeferredClassInstance dci,
|
||||||
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
ICPPTemplateParameterMap tpMap, int packOffset, ICPPTypeSpecialization within, IASTNode point) {
|
||||||
ICPPClassTemplate classTemplate = dci.getClassTemplate();
|
ICPPClassTemplate classTemplate = dci.getClassTemplate();
|
||||||
ICPPTemplateArgument[] arguments = dci.getTemplateArguments();
|
ICPPTemplateArgument[] arguments = dci.getTemplateArguments();
|
||||||
ICPPTemplateArgument[] newArgs;
|
ICPPTemplateArgument[] newArgs;
|
||||||
|
|
|
@ -51,12 +51,12 @@ import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
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.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -356,7 +356,7 @@ public class EvalBinary extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation arg1 = fArg1.instantiate(tpMap, packOffset, within, maxdepth, point);
|
ICPPEvaluation arg1 = fArg1.instantiate(tpMap, packOffset, within, maxdepth, point);
|
||||||
ICPPEvaluation arg2 = fArg2.instantiate(tpMap, packOffset, within, maxdepth, point);
|
ICPPEvaluation arg2 = fArg2.instantiate(tpMap, packOffset, within, maxdepth, point);
|
||||||
if (arg1 == fArg1 && arg2 == fArg2)
|
if (arg1 == fArg1 && arg2 == fArg2)
|
||||||
|
|
|
@ -19,8 +19,8 @@ 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.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -132,7 +132,7 @@ public class EvalBinaryTypeId extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
IType type1 = CPPTemplates.instantiateType(fType1, tpMap, packOffset, within, point);
|
IType type1 = CPPTemplates.instantiateType(fType1, tpMap, packOffset, within, point);
|
||||||
IType type2 = CPPTemplates.instantiateType(fType2, tpMap, packOffset, within, point);
|
IType type2 = CPPTemplates.instantiateType(fType2, tpMap, packOffset, within, point);
|
||||||
if (type1 == fType1 && type2 == fType2)
|
if (type1 == fType1 && type2 == fType2)
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameterPackType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameterPackType;
|
||||||
|
@ -38,6 +37,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IInternalVariable;
|
import org.eclipse.cdt.internal.core.dom.parser.IInternalVariable;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
|
@ -377,7 +377,7 @@ public class EvalBinding extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
IBinding origBinding = getBinding();
|
IBinding origBinding = getBinding();
|
||||||
if (origBinding instanceof ICPPTemplateNonTypeParameter) {
|
if (origBinding instanceof ICPPTemplateNonTypeParameter) {
|
||||||
if (tpMap != null) {
|
if (tpMap != null) {
|
||||||
|
|
|
@ -20,9 +20,9 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
|
@ -185,7 +185,7 @@ public class EvalComma extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation[] args = fArguments;
|
ICPPEvaluation[] args = fArguments;
|
||||||
for (int i = 0; i < fArguments.length; i++) {
|
for (int i = 0; i < fArguments.length; i++) {
|
||||||
ICPPEvaluation arg = fArguments[i].instantiate(tpMap, packOffset, within, maxdepth, point);
|
ICPPEvaluation arg = fArguments[i].instantiate(tpMap, packOffset, within, maxdepth, point);
|
||||||
|
|
|
@ -18,8 +18,8 @@ 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.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ICPPEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
|
@ -100,7 +100,7 @@ public class EvalCompound extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation delegate = fDelegate.instantiate(tpMap, packOffset, within, maxdepth, point);
|
ICPPEvaluation delegate = fDelegate.instantiate(tpMap, packOffset, within, maxdepth, point);
|
||||||
if (delegate == fDelegate)
|
if (delegate == fDelegate)
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -28,10 +28,10 @@ import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
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.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -342,7 +342,7 @@ public class EvalConditional extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation condition = fCondition.instantiate(tpMap, packOffset, within, maxdepth, point);
|
ICPPEvaluation condition = fCondition.instantiate(tpMap, packOffset, within, maxdepth, point);
|
||||||
ICPPEvaluation positive = fPositive == null ?
|
ICPPEvaluation positive = fPositive == null ?
|
||||||
null : fPositive.instantiate(tpMap, packOffset, within, maxdepth, point);
|
null : fPositive.instantiate(tpMap, packOffset, within, maxdepth, point);
|
||||||
|
|
|
@ -19,8 +19,8 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -165,7 +165,7 @@ public class EvalFixed extends CPPEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
IType type = CPPTemplates.instantiateType(fType, tpMap, packOffset, within, point);
|
IType type = CPPTemplates.instantiateType(fType, tpMap, packOffset, within, point);
|
||||||
IValue value = CPPTemplates.instantiateValue(fValue, tpMap, packOffset, within, maxdepth, point);
|
IValue value = CPPTemplates.instantiateValue(fValue, tpMap, packOffset, within, maxdepth, point);
|
||||||
if (type == fType && value == fValue)
|
if (type == fType && value == fValue)
|
||||||
|
|
|
@ -28,11 +28,11 @@ import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
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.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -191,7 +191,7 @@ public class EvalFunctionCall extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation[] args = instantiateCommaSeparatedSubexpressions(fArguments, tpMap,
|
ICPPEvaluation[] args = instantiateCommaSeparatedSubexpressions(fArguments, tpMap,
|
||||||
packOffset, within, maxdepth, point);
|
packOffset, within, maxdepth, point);
|
||||||
if (args == fArguments)
|
if (args == fArguments)
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
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.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
|
@ -228,7 +229,7 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
if (fFunctionSet == null)
|
if (fFunctionSet == null)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
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.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.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;
|
||||||
|
@ -49,6 +48,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
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.ICPPTemplateNonTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
|
@ -318,7 +318,7 @@ public class EvalID extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPTemplateArgument[] templateArgs = fTemplateArgs;
|
ICPPTemplateArgument[] templateArgs = fTemplateArgs;
|
||||||
if (templateArgs != null) {
|
if (templateArgs != null) {
|
||||||
templateArgs = instantiateArguments(templateArgs, tpMap, packOffset, within, point);
|
templateArgs = instantiateArguments(templateArgs, tpMap, packOffset, within, point);
|
||||||
|
|
|
@ -18,8 +18,8 @@ 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.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
|
@ -109,7 +109,7 @@ public class EvalInitList extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation[] clauses = instantiateCommaSeparatedSubexpressions(fClauses, tpMap,
|
ICPPEvaluation[] clauses = instantiateCommaSeparatedSubexpressions(fClauses, tpMap,
|
||||||
packOffset, within, maxdepth, point);
|
packOffset, within, maxdepth, point);
|
||||||
if (clauses == fClauses)
|
if (clauses == fClauses)
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -340,7 +341,7 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
IType ownerType = CPPTemplates.instantiateType(fOwnerType, tpMap, packOffset, within, point);
|
IType ownerType = CPPTemplates.instantiateType(fOwnerType, tpMap, packOffset, within, point);
|
||||||
if (ownerType == fOwnerType)
|
if (ownerType == fOwnerType)
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -15,8 +15,8 @@ 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.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -96,8 +96,9 @@ public class EvalParameterPack extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation expansionPattern = fExpansionPattern.instantiate(tpMap, packOffset, within, maxdepth, point);
|
ICPPEvaluation expansionPattern = fExpansionPattern.instantiate(tpMap, packOffset, within,
|
||||||
|
maxdepth, point);
|
||||||
if (expansionPattern == fExpansionPattern)
|
if (expansionPattern == fExpansionPattern)
|
||||||
return this;
|
return this;
|
||||||
return new EvalParameterPack(expansionPattern, getTemplateDefinition());
|
return new EvalParameterPack(expansionPattern, getTemplateDefinition());
|
||||||
|
@ -106,7 +107,8 @@ public class EvalParameterPack extends CPPDependentEvaluation {
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation computeForFunctionCall(CPPFunctionParameterMap parameterMap,
|
public ICPPEvaluation computeForFunctionCall(CPPFunctionParameterMap parameterMap,
|
||||||
ConstexprEvaluationContext context) {
|
ConstexprEvaluationContext context) {
|
||||||
ICPPEvaluation expansionPattern = fExpansionPattern.computeForFunctionCall(parameterMap, context.recordStep());
|
ICPPEvaluation expansionPattern = fExpansionPattern.computeForFunctionCall(parameterMap,
|
||||||
|
context.recordStep());
|
||||||
if (expansionPattern == fExpansionPattern)
|
if (expansionPattern == fExpansionPattern)
|
||||||
return this;
|
return this;
|
||||||
return new EvalParameterPack(expansionPattern, getTemplateDefinition());
|
return new EvalParameterPack(expansionPattern, getTemplateDefinition());
|
||||||
|
|
|
@ -22,11 +22,11 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
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.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
|
@ -215,7 +215,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation[] args= instantiateCommaSeparatedSubexpressions(fArguments, tpMap, packOffset, within, maxdepth, point);
|
ICPPEvaluation[] args= instantiateCommaSeparatedSubexpressions(fArguments, tpMap, packOffset, within, maxdepth, point);
|
||||||
IType type = CPPTemplates.instantiateType(fInputType, tpMap, packOffset, within, point);
|
IType type = CPPTemplates.instantiateType(fInputType, tpMap, packOffset, within, point);
|
||||||
if (args == fArguments && type == fInputType)
|
if (args == fArguments && type == fInputType)
|
||||||
|
|
|
@ -46,11 +46,11 @@ import org.eclipse.cdt.core.dom.ast.IPointerType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -350,19 +350,20 @@ public class EvalUnary extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
ICPPEvaluation argument = fArgument.instantiate(tpMap, packOffset, within, maxdepth, point);
|
ICPPEvaluation argument = fArgument.instantiate(tpMap, packOffset, within, maxdepth, point);
|
||||||
IBinding aoqn = fAddressOfQualifiedNameBinding;
|
IBinding binding = fAddressOfQualifiedNameBinding;
|
||||||
if (aoqn instanceof ICPPUnknownBinding) {
|
if (binding instanceof ICPPUnknownBinding) {
|
||||||
try {
|
try {
|
||||||
aoqn= CPPTemplates.resolveUnknown((ICPPUnknownBinding) aoqn, tpMap, packOffset, within, point);
|
binding= CPPTemplates.resolveUnknown((ICPPUnknownBinding) binding, tpMap, packOffset,
|
||||||
|
within, point);
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (argument == fArgument && aoqn == fAddressOfQualifiedNameBinding)
|
if (argument == fArgument && binding == fAddressOfQualifiedNameBinding)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
return new EvalUnary(fOperator, argument, aoqn, getTemplateDefinition());
|
return new EvalUnary(fOperator, argument, binding, getTemplateDefinition());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,8 +42,8 @@ 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.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTypeSpecialization;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
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.ProblemType;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
|
@ -203,7 +203,7 @@ public class EvalUnaryTypeID extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPTypeSpecialization within, int maxdepth, IASTNode point) {
|
||||||
if (fOperator == op_sizeofParameterPack) {
|
if (fOperator == op_sizeofParameterPack) {
|
||||||
int packSize = determinePackSize(tpMap);
|
int packSize = determinePackSize(tpMap);
|
||||||
if (packSize == CPPTemplates.PACK_SIZE_FAIL || packSize == CPPTemplates.PACK_SIZE_NOT_FOUND) {
|
if (packSize == CPPTemplates.PACK_SIZE_FAIL || packSize == CPPTemplates.PACK_SIZE_NOT_FOUND) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue