mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-18 14:35:23 +02:00
Bug 511726 - Handle unresolved field owner type in CPPASTFieldReference.getFieldPosition()
Change-Id: I0ded6f44f8aad69d54c361432afcb423ed6601b2
This commit is contained in:
parent
e6b9bee424
commit
63ed21e194
2 changed files with 9 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue