[clang] [llvm] [NFC][DebugInfo] Rewrite more call-sites to insert with iterators (PR #124288)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 08:36:46 PST 2025
================
@@ -823,7 +823,16 @@ static void updateScopeLine(Instruction *ActiveSuspend,
if (!ActiveSuspend)
return;
- auto *Successor = ActiveSuspend->getNextNonDebugInstruction();
+ // No subsequent instruction -> fallback to the location of ActiveSuspend.
+ if (!ActiveSuspend->getNextNonDebugInstruction()) {
+ if (auto DL = ActiveSuspend->getDebugLoc())
+ if (SPToUpdate.getFile() == DL->getFile())
+ SPToUpdate.setScopeLine(DL->getLine());
+ return;
+ }
+
+ BasicBlock::iterator Successor =
----------------
jmorse wrote:
The `_or_null` part is delt with in the "no subsequent instruction" portion I've added; the dyn_cast will dereference the iterator and examine the instruction automagically.
(The situation is a pain in the neck ._.)
https://github.com/llvm/llvm-project/pull/124288
More information about the llvm-commits
mailing list