| 166 | } |
| 167 | |
| 168 | void BasicStructureAnnotation::updateTypeInfo() const { |
| 169 | lock_guard<recursive_mutex> guard(walkMutex); |
| 170 | if ( !sti ) { |
| 171 | auto debugInfo = helpA.debugInfo; |
| 172 | sti = debugInfo->template makeNode<StructInfo>(); |
| 173 | sti->name = debugInfo->allocateName(name); |
| 174 | sti_gc = debugInfo->template makeNode<StructInfo>(); |
| 175 | sti_gc->name = sti->name; |
| 176 | // flags |
| 177 | sti->flags = 0; |
| 178 | sti_gc->flags = 0; |
| 179 | // count fields |
| 180 | sti->count = 0; |
| 181 | for ( auto & fi : fields ) { |
| 182 | auto & var = fi.second; |
| 183 | if ( var.offset != -1U ) { |
| 184 | sti->count ++; |
| 185 | } |
| 186 | } |
| 187 | // and allocate |
| 188 | sti_gc->count = 0; |
| 189 | sti->size = (uint32_t) getSizeOf(); |
| 190 | sti_gc->size = sti->size; |
| 191 | sti->fields = (VarInfo **) debugInfo->allocate( sizeof(VarInfo *) * sti->count ); |
| 192 | int i = 0; |
| 193 | for ( const auto & fn : fieldsInOrder ) { |
| 194 | auto itvar = fields.find(fn); |
| 195 | if ( itvar != fields.end() ) { |
| 196 | auto & var = itvar->second; |
| 197 | if ( var.offset != -1U ) { |
| 198 | VarInfo * vi = debugInfo->template makeNode<VarInfo>(); |
| 199 | helpA.makeTypeInfo(vi, var.decl); |
| 200 | vi->name = debugInfo->allocateName(fn); |
| 201 | vi->offset = var.offset; |
| 202 | sti->fields[i++] = vi; |
| 203 | if ( vi->flags & (TypeInfo::flag_heapGC | TypeInfo::flag_stringHeapGC) ) { |
| 204 | sti_gc->count++; |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | if ( sti_gc->count ) { |
| 210 | sti_gc->fields = (VarInfo **) debugInfo->allocate( sizeof(VarInfo *) * sti_gc->count ); |
| 211 | int j = 0; |
| 212 | for ( uint32_t n=0; n!=sti->count; ++n ) { |
| 213 | auto & fi = sti->fields[n]; |
| 214 | if ( fi->flags & (TypeInfo::flag_heapGC | TypeInfo::flag_stringHeapGC) ) { |
| 215 | sti_gc->fields[j++] = fi; |
| 216 | } |
| 217 | } |
| 218 | } else { |
| 219 | sti_gc->fields = nullptr; |
| 220 | } |
| 221 | sti->module_name = debugInfo->allocateCachedName(this->module->name); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | void BasicStructureAnnotation::walk ( DataWalker & walker, void * data ) { |
nothing calls this directly
no test coverage detected