Consider empty structs to be of size 1.

This commit is contained in:
cfreksen 2017-11-09 14:37:40 +01:00
parent bef14dfa24
commit 8afdf563b3
No known key found for this signature in database
GPG Key ID: EAC13EE101008978

View File

@ -486,7 +486,7 @@ def base_ty2size(base_ty):
elif isinstance(base_ty, ll.PointerType): elif isinstance(base_ty, ll.PointerType):
return 1 return 1
elif isinstance(base_ty, ll.StructType): elif isinstance(base_ty, ll.StructType):
return sum(map(base_ty2size, base_ty.fields)) return max(1, sum(map(base_ty2size, base_ty.fields)))
else: else:
# TODO # TODO
err('base_ty2size: Unknown type or illegal type: {}' err('base_ty2size: Unknown type or illegal type: {}'