Mercurial > projects > ldc
comparison gen/toir.cpp @ 485:50f6e2337a6b
Default initialize temporary struct generated from struct literal.
This makes sure padding is zeroed out.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 09 Aug 2008 09:03:52 +0200 |
parents | 672eb4893b55 |
children | a34078905d01 |
comparison
equal
deleted
inserted
replaced
484:1e96c742be5a | 485:50f6e2337a6b |
---|---|
2143 | 2143 |
2144 LLValue* mem = 0; | 2144 LLValue* mem = 0; |
2145 | 2145 |
2146 LLValue* sptr = DtoAlloca(llt,"tmpstructliteral"); | 2146 LLValue* sptr = DtoAlloca(llt,"tmpstructliteral"); |
2147 | 2147 |
2148 // default init the struct to take care of padding | |
2149 // and unspecified members | |
2150 TypeStruct* ts = (TypeStruct*)type; | |
2151 assert(ts->sym); | |
2152 DtoForceConstInitDsymbol(ts->sym); | |
2153 assert(ts->sym->ir.irStruct->init); | |
2154 DtoAggrCopy(sptr, ts->sym->ir.irStruct->init); | |
2148 | 2155 |
2149 // num elements in literal | 2156 // num elements in literal |
2150 unsigned n = elements->dim; | 2157 unsigned n = elements->dim; |
2151 | 2158 |
2152 // unions might have different types for each literal | 2159 // unions might have different types for each literal |