summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-04-05 17:38:32 +0200
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-04-05 17:38:32 +0200
commit3199a7687871747032553db560c60c737388e1ff (patch)
treeed9eceb036c5388a3821ecc96a2161df2652bf41
parent63b7a3447b6981940ebdf3da4db6815ac5c242e1 (diff)
types: Fallback to the specifyed layout if no underlying layout was found
This fixes a problem with uint32_t's layout in SM. cc: @nox
-rw-r--r--src/types.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/types.rs b/src/types.rs
index d16ee4df..9acf942e 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -193,7 +193,9 @@ impl Type {
TArray(_, _, l) => l.clone(),
TComp(ref ci) => ci.borrow().layout.clone(),
TEnum(ref ei) => ei.borrow().layout.clone(),
- TNamed(ref ti) => return ti.borrow().ty.layout(),
+ // Test first with the underlying type layout, else with the reported one
+ // This fixes a weird bug in SM when it can't find layout for uint32_t
+ TNamed(ref ti) => ti.borrow().ty.layout().unwrap_or(ti.borrow().layout.clone()),
TVoid |
TFuncProto(..) |
TFuncPtr(..) => return None,