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

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 07:26:54 PST 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 c546b5317c518987a5f45dd4c4d25321a955c758 b60342427447c46d646d3de5b91fcbdbcb8585d3 --extensions cpp -- clang/lib/CodeGen/CGObjCRuntime.cpp llvm/lib/IR/Verifier.cpp llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/lib/Transforms/Coroutines/CoroSplit.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp
index 3732c63559..a7f5c913f4 100644
--- a/clang/lib/CodeGen/CGObjCRuntime.cpp
+++ b/clang/lib/CodeGen/CGObjCRuntime.cpp
@@ -230,7 +230,8 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF,
     CodeGenFunction::LexicalScope Cleanups(CGF, Handler.Body->getSourceRange());
     SaveAndRestore RevertAfterScope(CGF.CurrentFuncletPad);
     if (useFunclets) {
-      llvm::BasicBlock::iterator CPICandidate = Handler.Block->getFirstNonPHIIt();
+      llvm::BasicBlock::iterator CPICandidate =
+          Handler.Block->getFirstNonPHIIt();
       if (CPICandidate != Handler.Block->end()) {
         if (auto *CPI = dyn_cast_or_null<llvm::CatchPadInst>(CPICandidate)) {
           CGF.CurrentFuncletPad = CPI;
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index c6c2a93baa..8432779c10 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -6521,7 +6521,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
       const ColorVector &CV = BlockEHFuncletColors.find(CallBB)->second;
       assert(CV.size() > 0 && "Uncolored block");
       for (BasicBlock *ColorFirstBB : CV)
-        if (auto It = ColorFirstBB->getFirstNonPHIIt(); It != ColorFirstBB->end())
+        if (auto It = ColorFirstBB->getFirstNonPHIIt();
+            It != ColorFirstBB->end())
           if (dyn_cast_or_null<FuncletPadInst>(&*It))
             InEHFunclet = true;
 
diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index f146d2c205..aa56fc5650 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -1469,16 +1469,17 @@ static void rewritePHIs(BasicBlock &BB) {
   LandingPadInst *LandingPad = nullptr;
   PHINode *ReplPHI = nullptr;
   if (!BB.empty()) {
-    if ((LandingPad = dyn_cast_or_null<LandingPadInst>(BB.getFirstNonPHIIt()))) {
+    if ((LandingPad =
+             dyn_cast_or_null<LandingPadInst>(BB.getFirstNonPHIIt()))) {
       // ehAwareSplitEdge will clone the LandingPad in all the edge blocks.
-      // We replace the original landing pad with a PHINode that will collect the
-      // results from all of them.
+      // We replace the original landing pad with a PHINode that will collect
+      // the results from all of them.
       ReplPHI = PHINode::Create(LandingPad->getType(), 1, "");
       ReplPHI->insertBefore(LandingPad->getIterator());
       ReplPHI->takeName(LandingPad);
       LandingPad->replaceAllUsesWith(ReplPHI);
-      // We will erase the original landing pad at the end of this function after
-      // ehAwareSplitEdge cloned it in the transition blocks.
+      // We will erase the original landing pad at the end of this function
+      // after ehAwareSplitEdge cloned it in the transition blocks.
     }
   }
 
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 202e635abc..00513126dd 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -832,7 +832,7 @@ static void updateScopeLine(Instruction *ActiveSuspend,
   }
 
   BasicBlock::iterator Successor =
-    ActiveSuspend->getNextNonDebugInstruction()->getIterator();
+      ActiveSuspend->getNextNonDebugInstruction()->getIterator();
   // Corosplit splits the BB around ActiveSuspend, so the meaningful
   // instructions are not in the same BB.
   if (auto *Branch = dyn_cast_or_null<BranchInst>(Successor);

``````````

</details>


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


More information about the llvm-commits mailing list