@@ -1400,30 +1400,32 @@ bool DWARFDebugLine::LineTable::lookupAddressRangeImpl(
14001400 SequenceIter SeqPos;
14011401
14021402 if (StmtSequenceOffset) {
1403- // If we have a statement sequence offset, find the specific sequence
1404- // Binary search for sequence with matching StmtSeqOffset
1405- Sequence.StmtSeqOffset = *StmtSequenceOffset;
1406- SeqPos = std::lower_bound (Sequences.begin (), LastSeq, Sequence,
1407- [](const DWARFDebugLine::Sequence &LHS,
1408- const DWARFDebugLine::Sequence &RHS) {
1409- return LHS.StmtSeqOffset < RHS.StmtSeqOffset ;
1410- });
1411-
1412- // If sequence not found or doesn't contain the address, return false
1413- if (SeqPos == LastSeq || SeqPos->StmtSeqOffset != *StmtSequenceOffset ||
1414- !SeqPos->containsPC (Address))
1403+ // If we have a statement sequence offset, find the specific sequence.
1404+ // Linear search for sequence with matching StmtSeqOffset
1405+ SeqPos = std::find_if (Sequences.begin (), LastSeq,
1406+ [&](const DWARFDebugLine::Sequence &S) {
1407+ return S.StmtSeqOffset == *StmtSequenceOffset;
1408+ });
1409+
1410+ // If sequence not found, return false
1411+ if (SeqPos == LastSeq)
14151412 return false ;
14161413
1417- // Set LastSeq to just past this sequence since we only want this one
1418- LastSeq = std::next (SeqPos);
1414+ // Set LastSeq to the next sequence since we only want the one matching
1415+ // sequence (sequences are guaranteed to have unique StmtSeqOffset)
1416+ LastSeq = SeqPos + 1 ;
14191417 } else {
14201418 // No specific sequence requested, find first sequence containing address
14211419 SeqPos = std::upper_bound (Sequences.begin (), LastSeq, Sequence,
14221420 DWARFDebugLine::Sequence::orderByHighPC);
1423- if (SeqPos == LastSeq || !SeqPos-> containsPC (Address) )
1421+ if (SeqPos == LastSeq)
14241422 return false ;
14251423 }
14261424
1425+ // If the start sequence doesn't contain the address, nothing to do
1426+ if (!SeqPos->containsPC (Address))
1427+ return false ;
1428+
14271429 SequenceIter StartPos = SeqPos;
14281430
14291431 // Process sequences that overlap with the desired range
0 commit comments