[PATCH] D60095: [LLD][COFF] Early load PDB type server files

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 06:52:28 PDT 2019


ruiu added a comment.

Overall looking good.



================
Comment at: COFF/DebugTypes.cpp:33-36
+  explicit TypeServerSource(MemoryBufferRef M)
+      : TpiSource(PDB, nullptr), MB(M) {
+    loadPDB();
+  }
----------------
If a constructor can fail, one pattern to handle that is to make the constructor private and instead provide `static ErrorOr<TypeServerSource> getInstance()` function. In that function, you can load a PDB and then instantiate TypeServerSouce only when the file loading succeeded. If failed, you can return an error.


================
Comment at: COFF/DebugTypes.cpp:149-150
+  // on Windows, so we can assume type server paths are Windows style.
+  Path += sys::path::filename(TSPath, sys::path::Style::windows);
+  return Path;
+}
----------------
nit: return Path + sys::path::...


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D60095





More information about the llvm-commits mailing list