[Lldb-commits] [PATCH] D139951: [lldb/crashlog] Refactor CrashLogParser into a Factory patern

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 15 09:49:19 PST 2022


kastiglione added inline comments.


================
Comment at: lldb/examples/python/crashlog.py:419-426
+def CrashLogParserFactory(debugger, path, verbose):
+    data = JSONCrashLogParser.is_valid_json(path)
+    if data:
+        parser = JSONCrashLogParser(debugger, path, verbose)
+        parser.data = data
+        return parser
+    else:
----------------
JDevlieghere wrote:
> This looks like a class now. The common patter for a factory is to create a static method (e.g. `create`) in the class you're instantiating. 
+1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139951/new/

https://reviews.llvm.org/D139951



More information about the lldb-commits mailing list