1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +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_sizeof:
case op_sizeofParameterPack: case op_sizeofParameterPack:
case op_alignof: case op_alignof:
IType o = CPPVisitor.get_SIZE_T(); IType result = (IType) CPPVisitor.get_SIZE_T().clone();
if (o instanceof CPPBasicType) { IType simplifiedResult = SemanticUtil.getSimplifiedType(result);
CPPBasicType t = (CPPBasicType) o.clone(); if (simplifiedResult instanceof CPPBasicType) {
if (getValue().numberValue() != null) CPPBasicType t = (CPPBasicType) simplifiedResult;
t.setAssociatedNumericalValue(getValue().numberValue().longValue()); IValue value = getValue();
return t; 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: case op_typeid:
return CPPVisitor.get_type_info(); return CPPVisitor.get_type_info();
case op_has_nothrow_copy: case op_has_nothrow_copy: