From 3f8d51e65bcfe47ffe890e2f7095dff759bdab09 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 27 Feb 2017 15:11:52 -0800 Subject: [PATCH] Added point parameter to the CompositeValue.create(ICPPClassType) method Change-Id: Ia3bb0dc48c90496242a696ec7126be2fd71e47fd --- .../cdt/internal/core/dom/parser/CompositeValue.java | 12 ++++++------ .../dom/parser/cpp/semantics/EvalConstructor.java | 2 +- .../core/dom/parser/cpp/semantics/EvalTypeId.java | 2 +- .../dom/parser/cpp/semantics/ExecDeclarator.java | 6 +++--- 4 files changed, 11 insertions(+), 11 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 1e02a2c9157..2ea509d264c 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 @@ -186,23 +186,23 @@ public final class CompositeValue implements IValue { * determined by the default member initializers only. Constructors are not considered * when determining the values of the fields. */ - public static CompositeValue create(ICPPClassType classType) { + public static CompositeValue create(ICPPClassType classType, IASTNode point) { Set recursionProtectionSet = fCreateInProgress.get(); if (!recursionProtectionSet.add(classType)) { return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY); } try { ActivationRecord record = new ActivationRecord(); - ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, null).length]; + ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length]; // Recursively create all the base class member variables. - ICPPBase[] bases = ClassTypeHelper.getBases(classType, null); + ICPPBase[] bases = ClassTypeHelper.getBases(classType, point); for (ICPPBase base : bases) { IBinding baseClass = base.getBaseClass(); if (baseClass instanceof ICPPClassType) { ICPPClassType baseClassType = (ICPPClassType) baseClass; - ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, null); - IValue compValue = CompositeValue.create(baseClassType); + ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point); + IValue compValue = CompositeValue.create(baseClassType, point); for (ICPPField baseField : baseFields) { int fieldPos = CPPASTFieldReference.getFieldPosition(baseField); if (fieldPos == -1) { @@ -217,7 +217,7 @@ public final class CompositeValue implements IValue { } } - ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, null); + ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point); for (ICPPField field : fields) { if (field.isStatic()) continue; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java index 4c049298ac8..fae6783f797 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java @@ -141,7 +141,7 @@ public final class EvalConstructor extends CPPDependentEvaluation { return this; } final ICPPClassType classType = (ICPPClassType) unwrappedType; - final CompositeValue compositeValue = CompositeValue.create(classType); + final CompositeValue compositeValue = CompositeValue.create(classType, context.getPoint()); ICPPEvaluation[] argList = evaluateArguments(fArguments, callSiteRecord, context); EvalFixed constructedObject = new EvalFixed(fType, ValueCategory.PRVALUE, compositeValue); CPPVariable binding = new CPPVariable(TEMP_NAME); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java index 9a323a6c5eb..910eb1d95b4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java @@ -150,7 +150,7 @@ public class EvalTypeId extends CPPDependentEvaluation { ICPPClassType classType = (ICPPClassType) fInputType; IBinding ctor = getConstructor(point); if (EvalUtil.isCompilerGeneratedCtor(ctor)) { - return CompositeValue.create(classType); + return CompositeValue.create(classType, point); } else if (ctor == AGGREGATE_INITIALIZATION) { return CompositeValue.create(new EvalInitList(fArguments, getTemplateDefinition()), classType, point); 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 6f9b5318d86..07476efcbbe 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 @@ -88,7 +88,7 @@ public final class ExecDeclarator implements ICPPExecution { private ICPPEvaluation createInitialValue(IType type, ActivationRecord record, ConstexprEvaluationContext context) { if (initializerEval == null) - return createDefaultInitializedCompositeValue(type); + return createDefaultInitializedCompositeValue(type, context.getPoint()); IType nestedType = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE); @@ -125,14 +125,14 @@ public final class ExecDeclarator implements ICPPExecution { computedInitializerEval.getValue(context.getPoint())); } - private static ICPPEvaluation createDefaultInitializedCompositeValue(IType type) { + private static ICPPEvaluation createDefaultInitializedCompositeValue(IType type, IASTNode point) { if (!(type instanceof ICPPClassType)) { return EvalFixed.INCOMPLETE; } ICPPClassType classType = (ICPPClassType) type; // TODO(nathanridge): CompositeValue.create() only consider default member initializers, not // constructors. Should we be considering constructors here as well? - IValue compositeValue = CompositeValue.create(classType); + IValue compositeValue = CompositeValue.create(classType, point); EvalFixed initialValue = new EvalFixed(type, ValueCategory.PRVALUE, compositeValue); return initialValue; }