Skip to content

Commit 2ac9034

Browse files
committed
Fix matching DILexicalBlock
1 parent 376e629 commit 2ac9034

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

llvm/lib/IR/DebugInfoMetadata.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,17 @@ static DIScope *GetNearestCommonScope(DILocation *L1, DILocation *L2) {
226226
}
227227
}
228228

229+
// Try matching DILexicalBlocks enclosing L1, L2.
230+
if (auto *LB1 = dyn_cast<DILexicalBlock>(S1)) {
231+
if (auto *LB2 = dyn_cast<DILexicalBlock>(S2)) {
232+
if (LB1->getFile() && LB1->getFile() == LB2->getFile() &&
233+
LB1->getLine() == LB2->getLine() &&
234+
LB1->getColumn() == LB2->getColumn()) {
235+
return LB1;
236+
}
237+
}
238+
}
239+
229240
SmallPtrSet<DIScope *, 8> Scopes;
230241
for (; S1; S1 = S1->getScope()) {
231242
Scopes.insert(S1);

0 commit comments

Comments
 (0)