[PATCH] D74773: [LLD][Debuginfo] create DWARFContext only once for the same object file.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 23:01:40 PST 2020


ruiu added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:269
+  llvm::call_once(initDwarf, [this]() {
+    dwarf = std::make_unique<DWARFCache>(std::make_unique<DWARFContext>(
+        std::make_unique<LLDDwarfObj<ELFT>>(this), "",
----------------
`make` is an lld's way of memory management, and I don't think you need to change this, so replace `std::make_unique<DWARFCache>` with `make<DWARFCache>`.


================
Comment at: lld/ELF/InputFiles.h:288
   // parse it only once for each object file we link.
-  DWARFCache *dwarf;
-  llvm::once_flag initDwarfLine;
+  std::unique_ptr<DWARFCache> dwarf;
+  llvm::once_flag initDwarf;
----------------
I think you don't need to change this line


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74773





More information about the llvm-commits mailing list