authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-24 02:14:55-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-11-02 21:54:24-04:00
log9a99bd3a71f1b20afd155f440c8dedd69273e8cb
treef062bc2a69ec566dbab245c90520f81310c3efd0
parent94ec2190f8d8c41d19b668511bf31fae32bcd095

use llvm named structs for const values when possible

normally we want to use llvm types for constants. but union constants (which are found inside enums) when they are initialized with the non-most-aligned-member must be unnamed structs. these bubble up to all aggregate types. if a constant of an aggregate type contains, recursively, a union constant with a non-most-aligned-member initialized, the aggregate typed constant must be unnamed too. this fixes all the asserts that were coming in from llvm master branch.

2 files changed, 3 insertions(+), 1 deletions(-)

src/target.cpp+1
...@@ -183,6 +183,7 @@ static const ZigLLVM_EnvironmentType environ_list[] = {...@@ -183,6 +183,7 @@ static const ZigLLVM_EnvironmentType environ_list[] = {
183 ZigLLVM_AMDOpenCL,183 ZigLLVM_AMDOpenCL,
184 ZigLLVM_CoreCLR,184 ZigLLVM_CoreCLR,
185 ZigLLVM_OpenCL,185 ZigLLVM_OpenCL,
186 ZigLLVM_Simulator,
186};187};
187188
188static const ZigLLVM_ObjectFormatType oformat_list[] = {189static const ZigLLVM_ObjectFormatType oformat_list[] = {
src/zig_llvm.hpp+2-1
...@@ -339,8 +339,9 @@ enum ZigLLVM_EnvironmentType {...@@ -339,8 +339,9 @@ enum ZigLLVM_EnvironmentType {
339 ZigLLVM_AMDOpenCL,339 ZigLLVM_AMDOpenCL,
340 ZigLLVM_CoreCLR,340 ZigLLVM_CoreCLR,
341 ZigLLVM_OpenCL,341 ZigLLVM_OpenCL,
342 ZigLLVM_Simulator, // Simulator variants of other systems, e.g., Apple's iOS
342343
343 ZigLLVM_LastEnvironmentType = ZigLLVM_OpenCL344 ZigLLVM_LastEnvironmentType = ZigLLVM_Simulator
344};345};
345346
346enum ZigLLVM_ObjectFormatType {347enum ZigLLVM_ObjectFormatType {