Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorHannes Vogt2019-05-23 02:49:16 -0400
committerHannes Vogt2019-05-27 14:56:02 -0400
commitdc62eb218dc16e5a422b6a343b42003bba78067f (patch)
treeb9c0ae1025a445d8d0dadfbc32c35e003cfedd2d /core
parent9e4c36a7ab1abdad4651d2687d5881103b3a9419 (diff)
downloadorg.eclipse.cdt-dc62eb218dc16e5a422b6a343b42003bba78067f.tar.gz
org.eclipse.cdt-dc62eb218dc16e5a422b6a343b42003bba78067f.tar.xz
org.eclipse.cdt-dc62eb218dc16e5a422b6a343b42003bba78067f.zip
Bug 547534 - Resolve TDEF in getFieldPosition()
and propagate a ProblemType in EvalCompositeAccess. Change-Id: I20c580c681ea5916d2e1c249b96f41c9dc95082f Signed-off-by: Hannes Vogt <hannes@havogt.de>
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java3
2 files changed, 5 insertions, 1 deletions
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 89d24112b7..35c35b6479 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
@@ -19,6 +19,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
+import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import java.util.ArrayList;
import java.util.Arrays;
@@ -353,7 +354,7 @@ public class CPPASTFieldReference extends ASTNode
}
public static int getFieldPosition(IBinding binding, IType ownerType) {
- final IType nestedType = SemanticUtil.getNestedType(ownerType, ALLCVQ);
+ final IType nestedType = SemanticUtil.getNestedType(ownerType, ALLCVQ | TDEF);
if (nestedType instanceof ICPPClassType && binding instanceof ICPPField) {
final ICPPField field = (ICPPField) binding;
return getFieldPosition(field);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java
index f19ee15571..7adf590010 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java
@@ -19,6 +19,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.IField;
+import org.eclipse.cdt.core.dom.ast.IProblemType;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@@ -119,6 +120,8 @@ public final class EvalCompositeAccess implements ICPPEvaluation {
return parameterPackType.getTypes()[elementId];
} else if (type instanceof ICPPBasicType) {
return type;
+ } else if (type instanceof IProblemType) {
+ return type;
}
return null;
}

Back to the top