1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 545756 - Handle the case where CPPVisitor.get_SIZE_T() returns a typedef

Change-Id: Ib30c68c4d7de72d9a6cb2a90b9030aaad4932e6f
This commit is contained in:
Nathan Ridge 2019-04-03 23:22:22 -04:00
parent 5bd43cf304
commit c39ddef02f

View file

@ -160,14 +160,18 @@ public class EvalUnaryTypeID extends CPPDependentEvaluation {
case op_sizeof:
case op_sizeofParameterPack:
case op_alignof:
IType o = CPPVisitor.get_SIZE_T();
if (o instanceof CPPBasicType) {
CPPBasicType t = (CPPBasicType) o.clone();
if (getValue().numberValue() != null)
t.setAssociatedNumericalValue(getValue().numberValue().longValue());
return t;
IType result = (IType) CPPVisitor.get_SIZE_T().clone();
IType simplifiedResult = SemanticUtil.getSimplifiedType(result);
if (simplifiedResult instanceof CPPBasicType) {
CPPBasicType t = (CPPBasicType) simplifiedResult;
IValue value = getValue();
if (value != null && value.numberValue() != null) {
t.setAssociatedNumericalValue(value.numberValue().longValue());
}
// We're still returning 'result', which is now modified.
// This preserves the 'size_t' typedef.
}
return o;
return result;
case op_typeid:
return CPPVisitor.get_type_info();
case op_has_nothrow_copy: