mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Bug 402601. Don't allow EvalTypeId.fArguments to be null to avoid NPE:s
in dependent code.
The most probable case of arguments being null was fixed in
ea53c271c9
.
Change-Id: I9d90bd0d4d09839ff9ed0cbc79e599485e878513
Signed-off-by: Jacek Sieka <arnetheduck@gmail.com>
Reviewed-on: https://git.eclipse.org/r/15522
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
06cea4bc3c
commit
3e0f5e9e44
1 changed files with 11 additions and 18 deletions
|
@ -39,9 +39,11 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
public EvalTypeId(IType type, IASTNode pointOfDefinition, ICPPEvaluation... arguments) {
|
||||
this(type, findEnclosingTemplate(pointOfDefinition), arguments);
|
||||
}
|
||||
|
||||
public EvalTypeId(IType type, IBinding templateDefinition, ICPPEvaluation... arguments) {
|
||||
super(templateDefinition);
|
||||
if (arguments == null)
|
||||
throw new NullPointerException("arguments"); //$NON-NLS-1$
|
||||
|
||||
fInputType= type;
|
||||
fArguments= arguments;
|
||||
}
|
||||
|
@ -82,9 +84,6 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
public IValue getValue(IASTNode point) {
|
||||
if (isValueDependent())
|
||||
return Value.create(this);
|
||||
if (fArguments == null)
|
||||
return Value.UNKNOWN;
|
||||
|
||||
if (isTypeDependent())
|
||||
return Value.create(this);
|
||||
if (fOutputType instanceof ICPPClassType) {
|
||||
|
@ -106,8 +105,6 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
|
||||
@Override
|
||||
public boolean isValueDependent() {
|
||||
if (fArguments == null)
|
||||
return false;
|
||||
for (ICPPEvaluation arg : fArguments) {
|
||||
if (arg.isValueDependent())
|
||||
return true;
|
||||
|
@ -157,9 +154,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
@Override
|
||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
||||
ICPPEvaluation[] args = null;
|
||||
if (fArguments != null)
|
||||
args = instantiateCommaSeparatedSubexpressions(fArguments, tpMap, packOffset, within, maxdepth, point);
|
||||
ICPPEvaluation[] args= instantiateCommaSeparatedSubexpressions(fArguments, tpMap, packOffset, within, maxdepth, point);
|
||||
IType type = CPPTemplates.instantiateType(fInputType, tpMap, packOffset, within, point);
|
||||
if (args == fArguments && type == fInputType)
|
||||
return this;
|
||||
|
@ -170,7 +165,6 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
public ICPPEvaluation computeForFunctionCall(CPPFunctionParameterMap parameterMap,
|
||||
int maxdepth, IASTNode point) {
|
||||
ICPPEvaluation[] args = fArguments;
|
||||
if (fArguments != null) {
|
||||
for (int i = 0; i < fArguments.length; i++) {
|
||||
ICPPEvaluation arg = fArguments[i].computeForFunctionCall(parameterMap, maxdepth, point);
|
||||
if (arg != fArguments[i]) {
|
||||
|
@ -181,7 +175,6 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
|||
args[i] = arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args == fArguments)
|
||||
return this;
|
||||
return new EvalTypeId(fInputType, getTemplateDefinition(), args);
|
||||
|
|
Loading…
Add table
Reference in a new issue