[lld] d7e6575 - [lld/mac] Tweak reserve() argument in unwind code
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 7 08:46:18 PDT 2021
Author: Nico Weber
Date: 2021-07-07T11:44:22-04:00
New Revision: d7e65757ed8f2dfe17b71cf169a3c83a155d1c2b
URL: https://github.com/llvm/llvm-project/commit/d7e65757ed8f2dfe17b71cf169a3c83a155d1c2b
DIFF: https://github.com/llvm/llvm-project/commit/d7e65757ed8f2dfe17b71cf169a3c83a155d1c2b.diff
LOG: [lld/mac] Tweak reserve() argument in unwind code
addEntriesForFunctionsWithoutUnwindInfo() can add entries to cuVector, so
cuCount can be stale. Use cuVector.size() instead.
No behavior change.
Added:
Modified:
lld/MachO/UnwindInfoSection.cpp
Removed:
################################################################################
diff --git a/lld/MachO/UnwindInfoSection.cpp b/lld/MachO/UnwindInfoSection.cpp
index 3bc1ec3445ff1..4864a248d6b16 100644
--- a/lld/MachO/UnwindInfoSection.cpp
+++ b/lld/MachO/UnwindInfoSection.cpp
@@ -379,7 +379,7 @@ template <class Ptr> void UnwindInfoSectionImpl<Ptr>::finalize() {
// Rather than sort & fold the 32-byte entries directly, we create a
// vector of pointers to entries and sort & fold that instead.
- cuPtrVector.reserve(cuCount);
+ cuPtrVector.reserve(cuVector.size());
for (CompactUnwindEntry<Ptr> &cuEntry : cuVector)
cuPtrVector.emplace_back(&cuEntry);
llvm::sort(cuPtrVector, [](const CompactUnwindEntry<Ptr> *a,
More information about the llvm-commits
mailing list