aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
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 /llvm/lib/Object/MachOObjectFile.cpp
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 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index aa57de1..5e6c6ea 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -2996,7 +2996,7 @@ void ExportEntry::pushNode(uint64_t offset) {
ErrorAsOutParameter ErrAsOutParam(E);
const uint8_t *Ptr = Trie.begin() + offset;
NodeState State(Ptr);
- const char *error;
+ const char *error = nullptr;
uint64_t ExportInfoSize = readULEB128(State.Current, &error);
if (error) {
*E = malformedError("export info size " + Twine(error) +
@@ -3131,7 +3131,7 @@ void ExportEntry::pushNode(uint64_t offset) {
void ExportEntry::pushDownUntilBottom() {
ErrorAsOutParameter ErrAsOutParam(E);
- const char *error;
+ const char *error = nullptr;
while (Stack.back().NextChildIndex < Stack.back().ChildCount) {
NodeState &Top = Stack.back();
CumulativeString.resize(Top.ParentStringLength);