Best Python code snippet using localstack_python
cleanup_check.py
Source:cleanup_check.py
...251 return252 # Now propagate to successor nodes.253 for edge in bb.succs:254 self.traverse_bbs(edge, edge.dest, bb.index, master_cleanup)255 def check_cleanups(self):256 if not self.fun.cfg or not self.fun.decl:257 return 'ignored'258 if is_destructor(self.fun.decl):259 return 'destructor'260 if needs_special_treatment(self.fun.decl):261 return 'special'262 self.is_constructor = is_constructor(self.fun.decl)263 self.is_special_constructor = not self.is_constructor and str(self.fun.decl.name).find('with_cleanup') > -1264 # Yuck.265 if str(self.fun.decl.name) == 'gdb_xml_create_parser_and_cleanup_1':266 self.is_special_constructor = True267 if self.is_special_constructor:268 gcc.inform(self.fun.start, 'function %s is a special constructor' % (self.fun.decl.name))269 # If we only see do_cleanups calls, and this function is not270 # itself a constructor, then we can convert it easily to RAII.271 self.only_do_cleanups_seen = not self.is_constructor272 # If we ever call a constructor, then we are "cleanup-aware".273 self.cleanup_aware = False274 entry_bb = self.fun.cfg.entry275 master_cleanup = MasterCleanup()276 self.traverse_bbs(None, entry_bb, -1, master_cleanup)277 if want_raii_info and self.only_do_cleanups_seen and self.cleanup_aware:278 gcc.inform(self.fun.decl.location,279 'function %s could be converted to RAII' % (self.fun.decl.name))280 if self.is_constructor:281 return 'constructor'282 return 'OK'283class CheckerPass(gcc.GimplePass):284 def execute(self, fun):285 if fun.decl:286 log("Starting " + fun.decl.name)287 if show_cfg:288 dot = gccutils.cfg_to_dot(fun.cfg, fun.decl.name)289 gccutils.invoke_dot(dot, name=fun.decl.name)290 checker = CleanupChecker(fun)291 what = checker.check_cleanups()292 if fun.decl:293 log(fun.decl.name + ': ' + what, 2)294ps = CheckerPass(name = 'check-cleanups')295# We need the cfg, but we want a relatively high-level Gimple....
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!