aboutsummaryrefslogtreecommitdiff
path: root/src/analyzer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-08-31 16:36:18 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-08-31 16:36:18 -0700
commit1e7f45eb40bf8597ae7b1263e9e546737979851c (patch)
tree7f645b51cb46b9b66323d8420e74b5b02cc71d32 /src/analyzer.js
parenta05dd4524a3ecab9fd43da6cfc3707f0f84875ea (diff)
llvm 3.0 anonymous structure support and metadata updates
Diffstat (limited to 'src/analyzer.js')
-rw-r--r--src/analyzer.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 824e7903..8e8f8ac7 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -107,6 +107,8 @@ function analyzer(data) {
// check that we never allocate with this (either as a child structure
// in the analyzer, or in calcSize in alloca).
var subType = check[2];
+ addTypeInternal(subType, data); // needed for anonymous structure definitions (see below)
+
Types.types[nonPointing] = {
name_: nonPointing,
fields: range(num).map(function() { return subType }),
@@ -124,6 +126,18 @@ function analyzer(data) {
return;
}
+ // anonymous structure definition, for example |{ i32, i8*, void ()*, i32 }|
+ if (type[0] == '{') {
+ Types.types[type] = {
+ name_: type,
+ fields: splitTokenList(tokenize(type.substr(2, type.length-4)).tokens).map(function(segment) {
+ return segment[0].text;
+ }),
+ lineNum: '?'
+ };
+ return;
+ }
+
if (isPointerType(type)) return;
if (['['].indexOf(type) != -1) return;
Types.types[type] = {