diff options
author | Alon Zakai <azakai@mozilla.com> | 2011-01-17 19:01:19 -0800 |
---|---|---|
committer | Alon Zakai <azakai@mozilla.com> | 2011-01-17 19:01:19 -0800 |
commit | 23515d06052a453efdb4d77fa517ebd14594d3be (patch) | |
tree | 4111e6f3513de81922307ef6f606b33e520e8f93 /src/analyzer.js | |
parent | 1f3de5c76e4947afccca350da24859e52f6aa83f (diff) |
handle odd llvm with branches in the middle of labels; all tests pass
Diffstat (limited to 'src/analyzer.js')
-rw-r--r-- | src/analyzer.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index 50683ec7..ae40896d 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -39,6 +39,7 @@ function analyzer(data, givenTypes) { }); // Functions & labels item.functions = []; + var currLabelFinished; // Sometimes LLVM puts a branch in the middle of a label. We need to ignore all lines after that. for (var i = 0; i < item.items.length; i++) { var subItem = item.items[i]; if (subItem.intertype == 'function') { @@ -60,10 +61,18 @@ function analyzer(data, givenTypes) { } else if (subItem.intertype == 'label') { item.functions.slice(-1)[0].labels.push(subItem); subItem.lines = []; + currLabelFinished = false; } else if (item.functions.length > 0 && item.functions.slice(-1)[0].endLineNum === null) { // Internal line - item.functions.slice(-1)[0].lines.push(subItem); - item.functions.slice(-1)[0].labels.slice(-1)[0].lines.push(subItem); + if (!currLabelFinished) { + item.functions.slice(-1)[0].lines.push(subItem); + item.functions.slice(-1)[0].labels.slice(-1)[0].lines.push(subItem); + if (subItem.intertype === 'branch') { + currLabelFinished = true; + } + } else { + print('// WARNING: content after a branch in a label, line: ' + subItem.lineNum); + } } else { print("ERROR: what is this? " + JSON.stringify(subItem)); } |