[llvm] [DebugInfo][RemoveDIs] Use autoupgrader to convert old debug-info (PR #143452)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 15:33:19 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/AsmParser/LLParser.cpp llvm/lib/IR/AsmWriter.cpp llvm/lib/IR/AutoUpgrade.cpp llvm/lib/IR/BasicBlock.cpp llvm/lib/IR/Verifier.cpp llvm/unittests/IR/DebugInfoTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 58875e59c..5a601a719 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -4402,7 +4402,7 @@ static MDType *unwrapMAVOp(CallBase *CI, unsigned Op) {
       // Use a reinterpret cast rather than a safe default-to-null cast: the
       // autoupgrade process happens before the verifier, and thus there might
       // be some nonsense metadata in there.
-      return reinterpret_cast<MDType*>(MAV->getMetadata());
+      return reinterpret_cast<MDType *>(MAV->getMetadata());
   }
   return nullptr;
 }
@@ -4413,7 +4413,7 @@ static const DILocation *getDebugLocSafe(const Instruction *I) {
   // runs before the verifier, so the Metadata could refer to anything. Allow
   // the verifier to detect and produce an error message, which will be much
   // more ergonomic to the user.
-  return (const DILocation*)MD;
+  return (const DILocation *)MD;
 }
 
 /// Convert debug intrinsic calls to non-instruction debug records.
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 1ba1e89b0..9ec94a8b8 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -6729,7 +6729,8 @@ void Verifier::visit(DbgVariableRecord &DVR) {
       // Allow integers here to support inttoptr salvage.
       Type *Ty = VAM->getValue()->getType();
       CheckDI(Ty->isPointerTy() || Ty->isIntegerTy(),
-              "location of #dbg_declare must be a pointer or int", &DVR, MD, BB, F);
+              "location of #dbg_declare must be a pointer or int", &DVR, MD, BB,
+              F);
     }
   } else if (auto *AL = dyn_cast<DIArgList>(MD)) {
     visitDIArgList(*AL, F);
@@ -6740,12 +6741,14 @@ void Verifier::visit(DbgVariableRecord &DVR) {
   visitMDNode(*DVR.getRawVariable(), AreDebugLocsAllowed::No);
 
   CheckDI(isa_and_nonnull<DIExpression>(DVR.getRawExpression()),
-          "invalid #dbg record expression", &DVR, DVR.getRawExpression(), BB, F);
+          "invalid #dbg record expression", &DVR, DVR.getRawExpression(), BB,
+          F);
   visitMDNode(*DVR.getExpression(), AreDebugLocsAllowed::No);
 
   if (DVR.isDbgAssign()) {
     CheckDI(isa_and_nonnull<DIAssignID>(DVR.getRawAssignID()),
-            "invalid #dbg_assign DIAssignID", &DVR, DVR.getRawAssignID(), BB, F);
+            "invalid #dbg_assign DIAssignID", &DVR, DVR.getRawAssignID(), BB,
+            F);
     visitMDNode(*cast<DIAssignID>(DVR.getRawAssignID()),
                 AreDebugLocsAllowed::No);
 
@@ -6773,8 +6776,8 @@ void Verifier::visit(DbgVariableRecord &DVR) {
 
   // This check is redundant with one in visitLocalVariable().
   DILocalVariable *Var = DVR.getVariable();
-  CheckDI(isType(Var->getRawType()), "invalid type ref", Var,
-          Var->getRawType(), BB, F);
+  CheckDI(isType(Var->getRawType()), "invalid type ref", Var, Var->getRawType(),
+          BB, F);
 
   auto *DLNode = DVR.getDebugLoc().getAsMDNode();
   CheckDI(isa_and_nonnull<DILocation>(DLNode), "invalid #dbg record DILocation",

``````````

</details>


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


More information about the llvm-commits mailing list