diff options
author | Adrian Prantl <aprantl@apple.com> | 2023-11-27 10:42:57 -0800 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2023-11-29 12:47:27 -0800 |
commit | 2c07181424b45d0785002b760f9ab404b7506b57 (patch) | |
tree | 5426c6df06ad00310416476b84fcc56cf516fcee /llvm/lib/Object/MachOObjectFile.cpp | |
parent | 076bd22f579ec4c90b41c700fca21a90fd2b6dbc (diff) | |
download | llvm-2c07181424b45d0785002b760f9ab404b7506b57.zip llvm-2c07181424b45d0785002b760f9ab404b7506b57.tar.gz llvm-2c07181424b45d0785002b760f9ab404b7506b57.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.cpp | 4 |
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); |