[PATCH] D116434: [lld-link] Replace LazyObjFile with lazy ObjFile/BitcodeFile

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 3 15:06:47 PST 2022


MaskRay added inline comments.


================
Comment at: lld/COFF/InputFiles.cpp:138
 
-void LazyObjFile::fetch() {
-  if (mb.getBuffer().empty())
-    return;
-
-  InputFile *file;
-  if (isBitcode(mb))
-    file = make<BitcodeFile>(ctx, mb, "", 0, std::move(symbols));
-  else
-    file = make<ObjFile>(ctx, mb, std::move(symbols));
-  mb = {};
-  ctx.symtab.addFile(file);
-}
-
-void LazyObjFile::parse() {
-  if (isBitcode(this->mb)) {
-    // Bitcode file.
-    std::unique_ptr<lto::InputFile> obj =
-        CHECK(lto::InputFile::create(this->mb), this);
-    for (const lto::InputFile::Symbol &sym : obj->symbols()) {
-      if (!sym.isUndefined())
-        ctx.symtab.addLazyObject(this, sym.getName());
-    }
-    return;
-  }
-
+void ObjFile::parseLazy() {
   // Native object file.
----------------
aganea wrote:
> Same comment as `BitcodeFile`, move code into `ObjFile::parse()`
Sam reply - the function will likely become more complex. A separate function will justify in the future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116434



More information about the llvm-commits mailing list