1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 540159 - ClassCastException in ExecDeclarator.unmarshal()

Change-Id: Ia51244b558798c052f1ec7a6918c6f85a6509655
This commit is contained in:
Nathan Ridge 2018-10-16 00:26:17 -04:00
parent a00346af22
commit 1cbe7e32b9

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@ -248,8 +249,15 @@ public final class ExecDeclarator implements ICPPExecution {
}
public static ICPPExecution unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException {
ICPPBinding declaredBinding = (ICPPBinding) buffer.unmarshalBinding();
IBinding declaredBinding = buffer.unmarshalBinding();
if (declaredBinding instanceof IProblemBinding) {
// The declared binding could not be stored in the index.
// If this happens, it's almost certainly a bug, but the severity
// is mitigated by returning a problem evaluation instead of just
// trying to cast to ICPPBinding and throwing a ClassCastException.
return ExecIncomplete.INSTANCE;
}
ICPPEvaluation initializerEval = buffer.unmarshalEvaluation();
return new ExecDeclarator(declaredBinding, initializerEval);
return new ExecDeclarator((ICPPBinding) declaredBinding, initializerEval);
}
}