Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2019-04-04 03:22:22 +0000
committerNathan Ridge2019-04-04 03:24:38 +0000
commitc39ddef02fa22af321e62c84e6eb1c938362929b (patch)
treeb1a218ef96fe732b0d8250310a89b9f604cf017b /core/org.eclipse.cdt.core/parser/org/eclipse
parent5bd43cf304999714f6e8b1c23638e7ffd0e51a74 (diff)
downloadorg.eclipse.cdt-c39ddef02fa22af321e62c84e6eb1c938362929b.tar.gz
org.eclipse.cdt-c39ddef02fa22af321e62c84e6eb1c938362929b.tar.xz
org.eclipse.cdt-c39ddef02fa22af321e62c84e6eb1c938362929b.zip
Bug 545756 - Handle the case where CPPVisitor.get_SIZE_T() returns a typedef
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java
index ff508152fbb..7d91bdeea9d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java
@@ -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:

Back to the top