diff options
author | Jeff Terrace <jterrace@gmail.com> | 2011-10-13 10:43:19 -0400 |
---|---|---|
committer | Jeff Terrace <jterrace@gmail.com> | 2011-10-13 10:43:19 -0400 |
commit | 8db994d1596ff691c2d603ebc6206bdfc73b2a4d (patch) | |
tree | ec5039d20cb6f5e89a6b1debad8738783029d919 /src/parseTools.js | |
parent | 51f9ca6e1c4ea9a164145e418f47374271e2f58a (diff) | |
parent | 3f227142c58c4a5543f6ba3f39ee35765304aa88 (diff) |
Merge branch 'master' of https://github.com/kripken/emscripten
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 7d62b34d..f9ef419a 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1074,6 +1074,10 @@ function handleOverflow(text, bits) { } } +function makeLLVMStruct(values) { // TODO: Use this everywhere + return '{ ' + values.map(function(value, i) { return 'f' + i + ': ' + value }).join(', ') + ' }' +} + // From parseLLVMSegment function finalizeLLVMParameter(param, noIndexizeFunctions) { var ret; @@ -1083,10 +1087,16 @@ function finalizeLLVMParameter(param, noIndexizeFunctions) { return toNiceIdentCarefully(param); } else if (param.intertype in PARSABLE_LLVM_FUNCTIONS) { ret = finalizeLLVMFunctionCall(param, noIndexizeFunctions); + } else if (param.ident == 'zeroinitializer') { + if (isStructType(param.type)) { + return makeLLVMStruct(zeros(Types.types[param.type].fields.length)); + } else { + return '0'; + } } else if (param.intertype == 'value') { ret = parseNumerical(param.ident); } else if (param.intertype == 'structvalue') { - ret = param.values.map(function(value) { return finalizeLLVMParameter(value, noIndexizeFunctions) }); + ret = makeLLVMStruct(param.values.map(function(value) { return finalizeLLVMParameter(value, noIndexizeFunctions) })); } else if (param.intertype === 'blockaddress') { return finalizeBlockAddress(param); } else if (param.intertype === 'type') { |