[clang] [llvm] [NFC][DebugInfo] Rewrite more call-sites to insert with iterators (PR #124288)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 06:55:47 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 =
----------------
OCHyams wrote:

this doesn't break the `dyn_cast_or_null` below?

https://github.com/llvm/llvm-project/pull/124288


More information about the llvm-commits mailing list