From 2c07181424b45d0785002b760f9ab404b7506b57 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 27 Nov 2023 10:42:57 -0800 Subject: [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. --- llvm/lib/Object/MachOObjectFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') 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); -- cgit v1.1