[PATCH] D92360: [lld/mac] Fix issues around thin archives

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 21:04:35 PST 2020


int3 added inline comments.


================
Comment at: lld/MachO/Driver.cpp:306
   for (StringRef path : args::getLines(mbref))
-    addFile(path);
-}
-
-static void forceLoadArchive(StringRef path) {
-  if (Optional<MemoryBufferRef> buffer = readFile(path))
-    for (MemoryBufferRef member : getArchiveMembers(*buffer))
-      inputFiles.push_back(make<ObjFile>(member));
+    addFile(path, false);
 }
----------------
int3 wrote:
> thakis wrote:
> > int3 wrote:
> > > int3 wrote:
> > > > same for the rest of the calls
> > > actually, I guess this would make for rather verbose code. How about making the parameter default to `false` instead?
> > I think lld code likes to be explicit about arguments -- cf LinkerDriver::enqueuePath() in lld/COFF/Driver.cpp which looks very similar to this.
> > 
> > If you hate the bool I can invent a two-state enum for this so that it's addFile(path, kForceLoadArchive), addFile(path, kRegularFile). But given that there are just a few callers, all in one file, and COFF doesn't do it, I'm not sure it's worth it?
> hm fine I guess this is okay as-is
actually, I do see quite a few LLD functions with default arguments... you can see a quick sample via

```
grep -r " = \"\")"
grep -r " = 0)"
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92360



More information about the llvm-commits mailing list