diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-01-03 12:54:24 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-01-03 12:54:24 +0000 |
| commit | eaeb601bd6a77b1f1c0889df45693d8c602e4863 (patch) | |
| tree | a1df69cf10c24dd323dc72a5757614cc65e9a82a /contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp | |
| parent | 82397d791966b09d344251bc709cd9db2b3a1902 (diff) | |
| parent | 1de062e1e530408f5a06466742b26722c230c024 (diff) | |
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.1-rc2-0-g43ff75f2c3f (aka 11.0.1 rc2).
MFC after: 4 weeks
X-MFC-With: r364284
Diffstat (limited to 'contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp index 3d4cecce27db..d27fd08db14e 100644 --- a/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp +++ b/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp @@ -286,10 +286,14 @@ const DWARFUnitIndex::Entry *DWARFUnitIndex::getFromHash(uint64_t S) const { auto H = S & Mask; auto HP = ((S >> 32) & Mask) | 1; - while (Rows[H].getSignature() != S && Rows[H].getSignature() != 0) + // The spec says "while 0 is a valid hash value, the row index in a used slot + // will always be non-zero". Loop until we find a match or an empty slot. + while (Rows[H].getSignature() != S && Rows[H].Index != nullptr) H = (H + HP) & Mask; - if (Rows[H].getSignature() != S) + // If the slot is empty, we don't care whether the signature matches (it could + // be zero and still match the zeros in the empty slot). + if (Rows[H].Index == nullptr) return nullptr; return &Rows[H]; |
