Skip to content

Commit 59f216a

Browse files
Cleanup
1 parent 6dbb0df commit 59f216a

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

lld/MachO/InputFiles.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,12 +2166,8 @@ void ArchiveFile::addLazySymbols() {
21662166
// Check `seen` but don't insert so a future eager load can still happen.
21672167
if (seen.contains(c.getChildOffset()))
21682168
continue;
2169-
if (!seenLazy.insert(c.getChildOffset()).second) {
2169+
if (!seenLazy.insert(c.getChildOffset()).second)
21702170
continue;
2171-
}
2172-
// First check seen.
2173-
// Then, write to and check seenLazy
2174-
// Then, get the file, check for error, and add it to inputs.
21752171
auto file = childToObjectFile(c, /*lazy=*/true);
21762172
if (!file)
21772173
error(toString(this) +
@@ -2232,8 +2228,7 @@ loadArchiveMember(MemoryBufferRef mb, uint32_t modTime, StringRef archiveName,
22322228
}
22332229
}
22342230

2235-
Error ArchiveFile::fetch(const object::Archive::Child &c, StringRef reason,
2236-
bool lazy) {
2231+
Error ArchiveFile::fetch(const object::Archive::Child &c, StringRef reason) {
22372232
if (!seen.insert(c.getChildOffset()).second)
22382233
return Error::success();
22392234
auto file = childToObjectFile(c, /*lazy=*/false);
@@ -2274,10 +2269,8 @@ ArchiveFile::childToObjectFile(const llvm::object::Archive::Child &c,
22742269
if (!modTime)
22752270
return modTime.takeError();
22762271

2277-
Expected<InputFile *> file =
2278-
loadArchiveMember(*mb, toTimeT(*modTime), getName(), c.getChildOffset(),
2279-
forceHidden, compatArch, lazy);
2280-
return file;
2272+
return loadArchiveMember(*mb, toTimeT(*modTime), getName(),
2273+
c.getChildOffset(), forceHidden, compatArch, lazy);
22812274
}
22822275

22832276
static macho::Symbol *createBitcodeSymbol(const lto::InputFile::Symbol &objSym,

lld/MachO/InputFiles.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,7 @@ class ArchiveFile final : public InputFile {
292292
void fetch(const llvm::object::Archive::Symbol &);
293293
// LLD normally doesn't use Error for error-handling, but the underlying
294294
// Archive library does, so this is the cleanest way to wrap it.
295-
Error fetch(const llvm::object::Archive::Child &, StringRef reason,
296-
bool lazy = false);
295+
Error fetch(const llvm::object::Archive::Child &, StringRef reason);
297296
const llvm::object::Archive &getArchive() const { return *file; };
298297
static bool classof(const InputFile *f) { return f->kind() == ArchiveKind; }
299298

lld/test/MachO/archive-no-index.s

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/lib2.o %t/lib2.s
77
# RUN: llvm-ar crST %t/lib.a %t/lib.o %t/lib2.o
88
# RUN: %lld %t/main.o %t/lib.a -o %t/out
9+
# RUN: llvm-nm %t/out | FileCheck %s
10+
11+
# CHECK-NOT: T _bar
12+
# CHECK: T _foo
913

1014
## Test that every kind of eager load mechanism still works.
1115
# RUN: %lld %t/main.o %t/lib.a -all_load -o %t/all_load
@@ -36,4 +40,4 @@ _bar:
3640
_main:
3741
call _foo
3842
mov $0, %rax
39-
ret
43+
ret

0 commit comments

Comments
 (0)