Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNathan Ridge2018-10-16 00:26:17 -0400
committerNathan Ridge2018-10-28 22:53:09 -0400
commit1cbe7e32b9098c2ecacb80db0c6e1b7a43ab2a9b (patch)
tree6d8334d2473a0e868163bd6487e6a5d319be86b8 /core
parenta00346af224c6a60a70151908790272d54d58955 (diff)
downloadorg.eclipse.cdt-1cbe7e32b9098c2ecacb80db0c6e1b7a43ab2a9b.tar.gz
org.eclipse.cdt-1cbe7e32b9098c2ecacb80db0c6e1b7a43ab2a9b.tar.xz
org.eclipse.cdt-1cbe7e32b9098c2ecacb80db0c6e1b7a43ab2a9b.zip
Bug 540159 - ClassCastException in ExecDeclarator.unmarshal()
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java
index dcddf9ac31..84fcc239d0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java
@@ -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);
}
}

Back to the top