mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 430230. Fixed loss of EvalTypeId arguments during
serialization/deserialization.
This commit is contained in:
parent
2c78dee75f
commit
526fd1eb55
4 changed files with 53 additions and 48 deletions
|
@ -2053,7 +2053,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// };
|
||||
//
|
||||
// typedef A<C> type;
|
||||
public void testSFINAE_a() throws Exception {
|
||||
public void testSfinae_a() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
|
@ -2085,7 +2085,22 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
// A<double>::get();
|
||||
// A<int>::get();
|
||||
// }
|
||||
public void testSFINAE_b() throws Exception {
|
||||
public void testSfinae_b() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
// template<typename T, typename = decltype(new T(0))>
|
||||
// static void test(int);
|
||||
//
|
||||
// template<typename>
|
||||
// static int test(...);
|
||||
|
||||
// struct A {};
|
||||
//
|
||||
// int waldo(int p);
|
||||
//
|
||||
// int x = waldo(test<A>(0));
|
||||
public void testSfinaeInNewExpression_430230() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
|
|
|
@ -76,20 +76,12 @@ public class EvalFunctionCall extends CPPDependentEvaluation {
|
|||
|
||||
@Override
|
||||
public boolean isTypeDependent() {
|
||||
for (ICPPEvaluation arg : fArguments) {
|
||||
if (arg.isTypeDependent())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return containsDependentType(fArguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValueDependent() {
|
||||
for (ICPPEvaluation arg : fArguments) {
|
||||
if (arg.isValueDependent())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return containsDependentValue(fArguments);
|
||||
}
|
||||
|
||||
public ICPPFunction getOverload(IASTNode point) {
|
||||
|
|
|
@ -144,18 +144,14 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
@Override
|
||||
public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException {
|
||||
short firstBytes = ITypeMarshalBuffer.EVAL_TYPE_ID;
|
||||
if (includeValue)
|
||||
firstBytes |= ITypeMarshalBuffer.FLAG1;
|
||||
if (fRepresentsNewExpression)
|
||||
firstBytes |= ITypeMarshalBuffer.FLAG2;
|
||||
firstBytes |= ITypeMarshalBuffer.FLAG1;
|
||||
|
||||
buffer.putShort(firstBytes);
|
||||
buffer.marshalType(fInputType);
|
||||
if (includeValue) {
|
||||
buffer.putInt(fArguments.length);
|
||||
for (ICPPEvaluation arg : fArguments) {
|
||||
buffer.marshalEvaluation(arg, includeValue);
|
||||
}
|
||||
buffer.putInt(fArguments.length);
|
||||
for (ICPPEvaluation arg : fArguments) {
|
||||
buffer.marshalEvaluation(arg, includeValue);
|
||||
}
|
||||
marshalTemplateDefinition(buffer);
|
||||
}
|
||||
|
@ -164,17 +160,13 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
throws CoreException {
|
||||
IType type= buffer.unmarshalType();
|
||||
ICPPEvaluation[] args= null;
|
||||
if ((firstBytes & ITypeMarshalBuffer.FLAG1) != 0) {
|
||||
int len= buffer.getInt();
|
||||
args = new ICPPEvaluation[len];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i]= (ICPPEvaluation) buffer.unmarshalEvaluation();
|
||||
}
|
||||
} else {
|
||||
args = ICPPEvaluation.EMPTY_ARRAY; // Arguments must not be null
|
||||
int len= buffer.getInt();
|
||||
args = new ICPPEvaluation[len];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i]= (ICPPEvaluation) buffer.unmarshalEvaluation();
|
||||
}
|
||||
IBinding templateDefinition= buffer.unmarshalBinding();
|
||||
boolean forNewExpression = (firstBytes & ITypeMarshalBuffer.FLAG2) != 0;
|
||||
boolean forNewExpression = (firstBytes & ITypeMarshalBuffer.FLAG1) != 0;
|
||||
return new EvalTypeId(type, templateDefinition, forNewExpression, args);
|
||||
}
|
||||
|
||||
|
@ -186,23 +178,26 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
if (args == fArguments && type == fInputType)
|
||||
return this;
|
||||
|
||||
if (!CPPTemplates.isDependentType(type) && !containsDependentType(args) && type instanceof ICPPClassType) {
|
||||
// Check the constructor call and return EvalFixed.INCOMPLETE to indicate a substitution
|
||||
// failure if the call cannot be resolved.
|
||||
ICPPClassType classType = (ICPPClassType) type;
|
||||
LookupData data = new LookupData(classType.getNameCharArray(), null, point);
|
||||
ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classType, point);
|
||||
data.foundItems = constructors;
|
||||
data.setFunctionArguments(false, args);
|
||||
try {
|
||||
IBinding binding = CPPSemantics.resolveFunction(data, constructors, true);
|
||||
if (binding == null || binding instanceof IProblemBinding ||
|
||||
binding instanceof ICPPFunction && ((ICPPFunction) binding).isDeleted()) {
|
||||
if (!CPPTemplates.isDependentType(type) && !containsDependentType(args)) {
|
||||
IType simplifiedType = SemanticUtil.getNestedType(type, SemanticUtil.TDEF);
|
||||
if (simplifiedType instanceof ICPPClassType) {
|
||||
// Check the constructor call and return EvalFixed.INCOMPLETE to indicate a substitution
|
||||
// failure if the call cannot be resolved.
|
||||
ICPPClassType classType = (ICPPClassType) type;
|
||||
LookupData data = new LookupData(classType.getNameCharArray(), null, point);
|
||||
ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classType, point);
|
||||
data.foundItems = constructors;
|
||||
data.setFunctionArguments(false, args);
|
||||
try {
|
||||
IBinding binding = CPPSemantics.resolveFunction(data, constructors, true);
|
||||
if (binding == null || binding instanceof IProblemBinding ||
|
||||
binding instanceof ICPPFunction && ((ICPPFunction) binding).isDeleted()) {
|
||||
return EvalFixed.INCOMPLETE;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
return EvalFixed.INCOMPLETE;
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
CCorePlugin.log(e);
|
||||
return EvalFixed.INCOMPLETE;
|
||||
}
|
||||
}
|
||||
return new EvalTypeId(type, getTemplateDefinition(), fRepresentsNewExpression, args);
|
||||
|
|
|
@ -245,11 +245,14 @@ public class PDOM extends PlatformObject implements IPDOM {
|
|||
* 160.0 - Store specialized template parameters of class/function template specializations, bug 407497.
|
||||
* 161.0 - Allow reference to PDOMBinding from other PDOMLinkages, bug 422681.
|
||||
* 162.0 - PDOMNode now stores the factoryId for loading, bug 422681.
|
||||
* 163.0 - QtLinkage changed storage format of QObject to accommodate QGadget.
|
||||
* #163.0# - QtLinkage changed storage format of QObject to accommodate QGadget. <<CDT 8.3>>
|
||||
*
|
||||
* CDT 8.4 development (versions not supported on the 8.3.x branch)
|
||||
* 170.0 - Unconditionally store arguments of EvalTypeId, bug 430230.
|
||||
*/
|
||||
private static final int MIN_SUPPORTED_VERSION= version(163, 0);
|
||||
private static final int MAX_SUPPORTED_VERSION= version(163, Short.MAX_VALUE);
|
||||
private static final int DEFAULT_VERSION = version(163, 0);
|
||||
private static final int MIN_SUPPORTED_VERSION= version(170, 0);
|
||||
private static final int MAX_SUPPORTED_VERSION= version(170, Short.MAX_VALUE);
|
||||
private static final int DEFAULT_VERSION = version(170, 0);
|
||||
|
||||
private static int version(int major, int minor) {
|
||||
return (major << 16) + minor;
|
||||
|
|
Loading…
Add table
Reference in a new issue