Create and return iterator for the available Configuration objects. The iterator loops over all Configurations in the dump file tree, in document order.
(self)
| 1275 | return list(self.iterconfigurations()) |
| 1276 | |
| 1277 | def iterconfigurations(self): |
| 1278 | """ |
| 1279 | Create and return iterator for the available Configuration objects. |
| 1280 | The iterator loops over all Configurations in the dump file tree, in document order. |
| 1281 | """ |
| 1282 | cfg = None |
| 1283 | cfg_arguments = [] # function arguments for Configuration node initialization |
| 1284 | cfg_function = None |
| 1285 | cfg_valueflow = None |
| 1286 | |
| 1287 | # Iterating <varlist> in a <scope>. |
| 1288 | iter_scope_varlist = False |
| 1289 | |
| 1290 | # Iterating <typedef-info> |
| 1291 | iter_typedef_info = False |
| 1292 | |
| 1293 | # Iterating <directive> |
| 1294 | iter_directive = False |
| 1295 | |
| 1296 | # Use iterable objects to traverse XML tree for dump files incrementally. |
| 1297 | # Iterative approach is required to avoid large memory consumption. |
| 1298 | # Calling .clear() is necessary to let the element be garbage collected. |
| 1299 | for event, node in ElementTree.iterparse(self.filename, events=('start', 'end')): |
| 1300 | # Serialize new configuration node |
| 1301 | if node.tag == 'dump': |
| 1302 | if event == 'start': |
| 1303 | cfg = Configuration(node.get('cfg')) |
| 1304 | continue |
| 1305 | if event == 'end': |
| 1306 | cfg.setIdMap(cfg_arguments) |
| 1307 | yield cfg |
| 1308 | cfg = None |
| 1309 | cfg_arguments = [] |
| 1310 | |
| 1311 | elif node.tag == 'clang-warning' and event == 'start': |
| 1312 | cfg.clang_warnings.append({'file': node.get('file'), |
| 1313 | 'line': int(node.get('line')), |
| 1314 | 'column': int(node.get('column')), |
| 1315 | 'message': node.get('message')}) |
| 1316 | # Parse standards |
| 1317 | elif node.tag == "standards" and event == 'start': |
| 1318 | continue |
| 1319 | elif node.tag == 'c' and event == 'start': |
| 1320 | cfg.standards.set_c(node) |
| 1321 | elif node.tag == 'cpp' and event == 'start': |
| 1322 | cfg.standards.set_cpp(node) |
| 1323 | elif node.tag == 'posix' and event == 'start': |
| 1324 | cfg.standards.set_posix(node) |
| 1325 | |
| 1326 | # Parse directives list |
| 1327 | elif node.tag == 'directive': |
| 1328 | if event == 'start': |
| 1329 | cfg.directives.append(Directive(node)) |
| 1330 | iter_directive = True |
| 1331 | elif event == 'end': |
| 1332 | iter_directive = False |
| 1333 | # Parse macro usage |
| 1334 | elif node.tag == 'macro' and event == 'start': |
no test coverage detected