Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2017-02-05 20:10:26 -0500
committerNathan Ridge2017-02-12 18:57:02 -0500
commit63ed21e19438f667b53e2ce1f5c123f80b3ee26c (patch)
tree0524b6bf2e31ca8a3dc7989d4c81f03156e1abb5
parente6b9bee424bfaf0792dd60f876201f9c3c22f759 (diff)
downloadorg.eclipse.cdt-63ed21e19438f667b53e2ce1f5c123f80b3ee26c.tar.gz
org.eclipse.cdt-63ed21e19438f667b53e2ce1f5c123f80b3ee26c.tar.xz
org.eclipse.cdt-63ed21e19438f667b53e2ce1f5c123f80b3ee26c.zip
Bug 511726 - Handle unresolved field owner type in CPPASTFieldReference.getFieldPosition()
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java3
2 files changed, 9 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java
index 3bb2101f05..3ba2828788 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java
@@ -205,6 +205,9 @@ public final class CompositeValue implements IValue {
IValue compValue = CompositeValue.create(baseClassType);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
+ if (fieldPos == -1) {
+ continue;
+ }
record.update(baseField, compValue.getSubValue(fieldPos));
// TODO(nathanridge): This won't work with multiple inheritance, since 'fieldPos'
// is a field position in the base class' hierarchy, while values[] expects
@@ -220,6 +223,9 @@ public final class CompositeValue implements IValue {
continue;
final ICPPEvaluation value = EvalUtil.getVariableValue(field, record);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
+ if (fieldPos == -1) {
+ continue;
+ }
record.update(field, value);
values[fieldPos] = value;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java
index abc62e673f..ab5c84b8b1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java
@@ -322,6 +322,9 @@ public class CPPASTFieldReference extends ASTNode
public static int getFieldPosition(ICPPField field) {
final ICPPClassType ownerType = field.getClassOwner();
+ if (ownerType == null) {
+ return -1;
+ }
final ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(ownerType, null);
int baseFields = 0;
for (ICPPClassType baseClass : baseClasses) {

Back to the top