[lld] 102d0a2 - [ELF] Simplify elf::link exit. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 15 17:59:10 PST 2022
Author: Fangrui Song
Date: 2022-01-15T17:59:05-08:00
New Revision: 102d0a2bafc76f1e8d1754ce55dad0faefb5e030
URL: https://github.com/llvm/llvm-project/commit/102d0a2bafc76f1e8d1754ce55dad0faefb5e030
DIFF: https://github.com/llvm/llvm-project/commit/102d0a2bafc76f1e8d1754ce55dad0faefb5e030.diff
LOG: [ELF] Simplify elf::link exit. NFC
Added:
Modified:
lld/ELF/Driver.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index e4c252a8988f1..5e7b74e2e4c55 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -129,13 +129,12 @@ bool elf::link(ArrayRef<const char *> args, bool canExitEarly,
// Exit immediately if we don't need to return to the caller.
// This saves time because the overhead of calling destructors
// for all globally-allocated objects is not negligible.
+ int hasError = errorCount() ? 1 : 0;
if (canExitEarly)
- exitLld(errorCount() ? 1 : 0);
-
- bool ret = errorCount() == 0;
- if (!canExitEarly)
+ exitLld(hasError);
+ else
errorHandler().reset();
- return ret;
+ return !hasError;
}
// Parses a linker -m option.
More information about the llvm-commits
mailing list