diff options
author | Adrian Thurston <thurston@complang.org> | 2014-12-25 18:59:31 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2014-12-25 18:59:31 -0500 |
commit | 8928a108648cdcdd729a737906198f007ce43be4 (patch) | |
tree | 09f1c33ec2bc31a81eef38141528868bcf4193ba /src/pdabuild.cc | |
parent | 1976d1c663c28f5f278774a9515087555fe92518 (diff) | |
download | colm-8928a108648cdcdd729a737906198f007ce43be4.tar.gz |
size and local trees computations for structs, global vars
Diffstat (limited to 'src/pdabuild.cc')
-rw-r--r-- | src/pdabuild.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/pdabuild.cc b/src/pdabuild.cc index f9cadb20..7fbab35f 100644 --- a/src/pdabuild.cc +++ b/src/pdabuild.cc @@ -1282,22 +1282,25 @@ short *Compiler::makeTrees( ObjectDef *objectDef, int &numTrees ) { numTrees = 0; for ( FieldList::Iter of = *objectDef->fieldList; of.lte(); of++ ) { - UniqueType *ut = of->value->typeRef->resolveType( this ); - if ( ut->typeId == TYPE_TREE || ut->typeId == TYPE_PTR ) - numTrees += 1; + if ( of->value->exists() ) { + UniqueType *ut = of->value->typeRef->resolveType( this ); + if ( ut->typeId == TYPE_TREE || ut->typeId == TYPE_PTR ) + numTrees += 1; + } } short *trees = new short[numTrees]; memset( trees, 0, sizeof(short) * numTrees ); - short pos = 0, fieldPos = 0;; + short pos = 0; for ( FieldList::Iter of = *objectDef->fieldList; of.lte(); of++ ) { - UniqueType *ut = of->value->typeRef->resolveType( this ); - if ( ut->typeId == TYPE_TREE || ut->typeId == TYPE_PTR ) { - trees[pos] = fieldPos; - pos += 1; + if ( of->value->exists() ) { + UniqueType *ut = of->value->typeRef->resolveType( this ); + if ( ut->typeId == TYPE_TREE || ut->typeId == TYPE_PTR ) { + trees[pos] = of->value->offset; + pos += 1; + } } - fieldPos += 1; } return trees; |