mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 505606 - OutOfMemoryError in indexer
Change-Id: Ibcff4aa82cf46f0ec01705715b98f881cb39dca5
This commit is contained in:
parent
662091c72d
commit
2d02ddf8ca
5 changed files with 35 additions and 11 deletions
|
@ -245,4 +245,20 @@ public class FunctionTests extends TestBase {
|
||||||
ICPPExecution bodyExec = CPPFunction.getFunctionBodyExecution(function, clause);
|
ICPPExecution bodyExec = CPPFunction.getFunctionBodyExecution(function, clause);
|
||||||
assertNull(bodyExec);
|
assertNull(bodyExec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// // Empty header file
|
||||||
|
|
||||||
|
// struct A {
|
||||||
|
// A() {}
|
||||||
|
// A& m(int p) {
|
||||||
|
// return *this;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// A a = A()
|
||||||
|
// .m(1).m(2).m(3).m(4).m(5).m(6).m(7).m(8).m(9).m(10)
|
||||||
|
// .m(11).m(12).m(13).m(14).m(15).m(16).m(17).m(18).m(19).m(20)
|
||||||
|
// .m(21).m(22).m(23).m(24).m(25).m(26).m(27).m(28).m(29).m(30);
|
||||||
|
public void testLongCallChain_505606() throws Exception {
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -243,6 +243,9 @@ public class CPPVariable extends PlatformObject implements ICPPInternalVariable
|
||||||
if (initEval == null) {
|
if (initEval == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (!initEval.isValueDependent() ) {
|
||||||
|
return initEval.getValue(fDefinition);
|
||||||
|
}
|
||||||
return IntegralValue.create(initEval);
|
return IntegralValue.create(initEval);
|
||||||
}
|
}
|
||||||
return initialValue;
|
return initialValue;
|
||||||
|
|
|
@ -119,10 +119,12 @@ public final class EvalConstructor extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IValue getValue(IASTNode point) {
|
public IValue getValue(IASTNode point) {
|
||||||
// An EvalConstructor is never used to directly represent the evaluation of an expression.
|
ICPPEvaluation computed =
|
||||||
// It only comes up while evaluating other evaluations. As such, its getValue() doesn't
|
computeForFunctionCall(new ActivationRecord(), new ConstexprEvaluationContext(point));
|
||||||
// do anything; computeForFunctionCall() must be called on it to obtain a useful result.
|
if (computed == this)
|
||||||
return IntegralValue.ERROR;
|
return IntegralValue.ERROR;
|
||||||
|
|
||||||
|
return computed.getValue(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -230,7 +230,7 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
|
||||||
ICPPParameter[] parameters = functionBinding.getParameters();
|
ICPPParameter[] parameters = functionBinding.getParameters();
|
||||||
for (int i = 0; i < fArguments.length; i++) {
|
for (int i = 0; i < fArguments.length; i++) {
|
||||||
ICPPEvaluation arg = fArguments[i].computeForFunctionCall(record, context.recordStep());
|
ICPPEvaluation arg = fArguments[i].computeForFunctionCall(record, context.recordStep());
|
||||||
if (i != 0 && isReference(parameters[i-1]) && fArguments[i] instanceof EvalBinding) {
|
if (0 < i && i <= parameters.length && isReference(parameters[i - 1]) && fArguments[i] instanceof EvalBinding) {
|
||||||
final EvalBinding evalBinding = (EvalBinding) fArguments[i];
|
final EvalBinding evalBinding = (EvalBinding) fArguments[i];
|
||||||
IBinding binding = evalBinding.getBinding();
|
IBinding binding = evalBinding.getBinding();
|
||||||
// If the binding being referenced isn't present in the activation record,
|
// If the binding being referenced isn't present in the activation record,
|
||||||
|
@ -239,7 +239,7 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
|
||||||
return EvalFixed.INCOMPLETE;
|
return EvalFixed.INCOMPLETE;
|
||||||
}
|
}
|
||||||
arg = new EvalReference(record, binding, evalBinding.getTemplateDefinition());
|
arg = new EvalReference(record, binding, evalBinding.getTemplateDefinition());
|
||||||
} else if (i != 0 && !isReference(parameters[i-1])) {
|
} else if (0 < i && i <= parameters.length && !isReference(parameters[i - 1])) {
|
||||||
IValue copiedValue = arg.getValue(context.getPoint()).clone();
|
IValue copiedValue = arg.getValue(context.getPoint()).clone();
|
||||||
arg = new EvalFixed(arg.getType(context.getPoint()), arg.getValueCategory(context.getPoint()), copiedValue);
|
arg = new EvalFixed(arg.getType(context.getPoint()), arg.getValueCategory(context.getPoint()), copiedValue);
|
||||||
}
|
}
|
||||||
|
@ -272,13 +272,15 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
|
||||||
|
|
||||||
// If the arguments are not all constant expressions, there is
|
// If the arguments are not all constant expressions, there is
|
||||||
// no point trying to substitute them into the return expression.
|
// no point trying to substitute them into the return expression.
|
||||||
if (!areAllConstantExpressions(fArguments, 1, fArguments.length, context.getPoint())) {
|
if (!areAllConstantExpressions(fArguments, 1, fArguments.length, context.getPoint()))
|
||||||
return EvalFixed.INCOMPLETE;
|
return EvalFixed.INCOMPLETE;
|
||||||
}
|
|
||||||
ICPPFunction function = resolveFunctionBinding(context.getPoint());
|
ICPPFunction function = resolveFunctionBinding(context.getPoint());
|
||||||
if (function == null) {
|
if (function == null)
|
||||||
return this;
|
return this;
|
||||||
}
|
|
||||||
|
if (!function.isConstexpr())
|
||||||
|
return EvalFixed.INCOMPLETE;
|
||||||
|
|
||||||
ActivationRecord record = createActivationRecord(function.getParameters(), fArguments, fImplicitThis, context.getPoint());
|
ActivationRecord record = createActivationRecord(function.getParameters(), fArguments, fImplicitThis, context.getPoint());
|
||||||
ICPPExecution bodyExec = CPPFunction.getFunctionBodyExecution(function, context.getPoint());
|
ICPPExecution bodyExec = CPPFunction.getFunctionBodyExecution(function, context.getPoint());
|
||||||
|
|
|
@ -88,7 +88,8 @@ public class EvalReference extends CPPDependentEvaluation {
|
||||||
if (referredSubValue != null) {
|
if (referredSubValue != null) {
|
||||||
return referredSubValue;
|
return referredSubValue;
|
||||||
}
|
}
|
||||||
return owningRecord.getVariable(referredBinding);
|
ICPPEvaluation targetValue = owningRecord.getVariable(referredBinding);
|
||||||
|
return targetValue == null ? EvalFixed.INCOMPLETE : targetValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(ICPPEvaluation eval) {
|
public void update(ICPPEvaluation eval) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue