diff options
| author | 2018-04-06 14:26:03 +0000 | |
|---|---|---|
| committer | 2018-04-06 14:26:03 +0000 | |
| commit | bdabc2f19ffb9e20600dad6e8a300842a7bda50e (patch) | |
| tree | c50e7b2e5449b074651bb82a58517a8ebc4a8cf7 /gnu/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp | |
| parent | Print a 'p' flag for file descriptors that were opened after pledge(2). (diff) | |
| download | wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.tar.xz wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.zip | |
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp')
| -rw-r--r-- | gnu/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gnu/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/gnu/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp index 59b3d0ca55a..17f17572a30 100644 --- a/gnu/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp +++ b/gnu/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp @@ -123,7 +123,7 @@ StringRef DWARFUnitIndex::getColumnHeader(DWARFSectionKind DS) { } void DWARFUnitIndex::dump(raw_ostream &OS) const { - if (!Header.NumBuckets) + if (!*this) return; Header.dump(OS); @@ -165,8 +165,25 @@ DWARFUnitIndex::Entry::getOffset() const { const DWARFUnitIndex::Entry * DWARFUnitIndex::getFromOffset(uint32_t Offset) const { for (uint32_t i = 0; i != Header.NumBuckets; ++i) - if (const auto &Contribs = Rows[i].Contributions) - if (Contribs[InfoColumn].Offset == Offset) + if (const auto &Contribs = Rows[i].Contributions) { + const auto &InfoContrib = Contribs[InfoColumn]; + if (InfoContrib.Offset <= Offset && + Offset < (InfoContrib.Offset + InfoContrib.Length)) return &Rows[i]; + } return nullptr; } + +const DWARFUnitIndex::Entry *DWARFUnitIndex::getFromHash(uint64_t S) const { + uint64_t Mask = Header.NumBuckets - 1; + + auto H = S & Mask; + auto HP = ((S >> 32) & Mask) | 1; + while (Rows[H].getSignature() != S && Rows[H].getSignature() != 0) + H = (H + HP) & Mask; + + if (Rows[H].getSignature() != S) + return nullptr; + + return &Rows[H]; +} |
