[llvm] [DebugInfo] Handle followup loop metadata in updateLoopMetadataDebugLocations (PR #157557)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 25 03:46:28 PDT 2025
================
@@ -375,6 +375,32 @@ bool DebugInfoFinder::addScope(DIScope *Scope) {
return true;
}
+/// Recursively handle DILocations in followup metadata etc.
+static Metadata *updateLoopMetadataDebugLocationsRecursive(
+ Metadata *MetadataIn, function_ref<Metadata *(Metadata *)> Updater) {
+ const MDTuple *M = dyn_cast_or_null<MDTuple>(MetadataIn);
+ // The loop metadata options should start with a MDString.
+ if (!M || M->getNumOperands() < 1 || !isa<MDString>(M->getOperand(0)))
+ return MetadataIn;
+
+ bool Updated = false;
+ SmallVector<Metadata *, 4> MDs{M->getOperand(0)};
+ for (Metadata *MD : llvm::drop_begin(M->operands())) {
+ if (!MD)
+ MDs.push_back(nullptr);
+ else {
----------------
Meinersbur wrote:
```suggestion
if (!MD) {
MDs.push_back(nullptr);
continue;
}
```
[style] [Use Early Exits and continue to Simplify Code](https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code)
https://github.com/llvm/llvm-project/pull/157557
More information about the llvm-commits
mailing list