[Lldb-commits] [lldb] [DRAFT] Add support for inline DWARF source files. (PR #75880)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 18 17:14:39 PST 2023


================
@@ -17,13 +17,40 @@
 namespace lldb_private {
 class Stream;
 
+/// Represents a source file whose contents is known (for example
+/// because it can be reconstructed from debug info), but that
+/// hasn't been written to a local disk yet.
+struct LazyFileSpec {
+  virtual ~LazyFileSpec() {}
+  virtual const FileSpec &Materialize() = 0;
+};
+
+/// Wraps either a FileSpec that represents a local file or a
+/// LazyFileSpec that could be materialized into a local file.
+class FileSpecHolder {
+  FileSpec m_file_spec;
+  std::shared_ptr<LazyFileSpec> m_lazy;
----------------
bulbazord wrote:

Why does this hold both if it could be either one? Why not use a discriminated/tagged/type-safe union like `std::variant` here?

https://github.com/llvm/llvm-project/pull/75880


More information about the lldb-commits mailing list