aboutsummaryrefslogtreecommitdiff
path: root/lld
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2023-11-27 10:42:57 -0800
committerAdrian Prantl <aprantl@apple.com>2023-11-29 12:16:32 -0800
commit545c8e009e2b649ef38f7e432ffbc06ba8a9b813 (patch)
tree8007ad66aee68be94642fce0b0bedca0675fe6b5 /lld
parent792253ae0ef3acf9e55f92de25e0bd47a8531d1a (diff)
downloadllvm-545c8e009e2b649ef38f7e432ffbc06ba8a9b813.zip
llvm-545c8e009e2b649ef38f7e432ffbc06ba8a9b813.tar.gz
llvm-545c8e009e2b649ef38f7e432ffbc06ba8a9b813.tar.bz2
[LEB128] Don't initialize error on success
This change removes an unnecessary branch from a hot path. It's also questionable API to override any previous error unconditonally.
Diffstat (limited to 'lld')
-rw-r--r--lld/COFF/Driver.cpp2
-rw-r--r--lld/ELF/Driver.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index f5cb379..327df607 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -1258,7 +1258,7 @@ static void findKeepUniqueSections(COFFLinkerContext &ctx) {
const uint8_t *cur = contents.begin();
while (cur != contents.end()) {
unsigned size;
- const char *err;
+ const char *err = nullptr;
uint64_t symIndex = decodeULEB128(cur, &size, contents.end(), &err);
if (err)
fatal(toString(obj) + ": could not decode addrsig section: " + err);
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 6290880..6bef09e 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -2296,7 +2296,7 @@ static void findKeepUniqueSections(opt::InputArgList &args) {
const uint8_t *cur = contents.begin();
while (cur != contents.end()) {
unsigned size;
- const char *err;
+ const char *err = nullptr;
uint64_t symIndex = decodeULEB128(cur, &size, contents.end(), &err);
if (err)
fatal(toString(f) + ": could not decode addrsig section: " + err);