[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
Mon Feb 24 18:52:04 PST 2020
ruiu added inline comments.
================
Comment at: lld/ELF/InputFiles.cpp:270
+ std::make_unique<LLDDwarfObj<ELFT>>(this), "",
+ [&](Error Err) { warn(getName() + ": " + toString(std::move(Err))); },
+ [&](Error Warning) {
----------------
Err -> err
================
Comment at: lld/ELF/InputFiles.cpp:271
+ [&](Error Err) { warn(getName() + ": " + toString(std::move(Err))); },
+ [&](Error Warning) {
+ warn(getName() + ": " + toString(std::move(Warning)));
----------------
Warning -> warning
================
Comment at: lld/ELF/InputFiles.cpp:309
+template <class ELFT> llvm::DWARFContext *ObjFile<ELFT>::getDWARFContext() {
+ llvm::call_once(initDwarf, [this]() { initializeDwarf(); });
+
----------------
Calling call_once from multiple places doesn't seem to be a very good way to manage object instantiation. How about this?
- Define getDwarf() function that returns a DWARFCache object. That function initializes Dwarf member if it is not initialized yet
- Remove initializeDwarf (since now getDwarf initializes the Dwarf member)
- Remove getDWARFContext and rewrite `getDWARFContext()` with `getDwarf()->getContext()`
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