[llvm] [DebugInfo] Enable deprecation of iterator-insertion methods (PR #102608)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 05:53:50 PDT 2024


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 059e7be2d1e4397fd40ecaaf913b8a4bfe759779 bb3f8509ca64d5845956e28c2a0b0435d6633f0a --extensions h,cpp -- llvm/examples/IRTransforms/SimplifyCFG.cpp llvm/include/llvm/IR/InstrTypes.h llvm/include/llvm/IR/Instruction.h llvm/include/llvm/IR/Instructions.h llvm/lib/SandboxIR/SandboxIR.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/examples/IRTransforms/SimplifyCFG.cpp b/llvm/examples/IRTransforms/SimplifyCFG.cpp
index 7df646c64c..a37060cedb 100644
--- a/llvm/examples/IRTransforms/SimplifyCFG.cpp
+++ b/llvm/examples/IRTransforms/SimplifyCFG.cpp
@@ -242,7 +242,8 @@ static bool eliminateCondBranches_v3(Function &F, DominatorTree &DT) {
     // a new unconditional branch to the selected successor and removing the
     // conditional one.
 
-    BranchInst *NewBranch = BranchInst::Create(TakenSucc, BB.getTerminator()->getIterator());
+    BranchInst *NewBranch =
+        BranchInst::Create(TakenSucc, BB.getTerminator()->getIterator());
     BB.getTerminator()->eraseFromParent();
 
     // Delete the edge between BB and RemovedSucc in the DominatorTree, iff
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 638ac66537..cda0c776fe 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -61,7 +61,7 @@ protected:
     Op<0>() = V;
   }
   LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
-    "BasicBlock::iterator")
+                  "BasicBlock::iterator")
   UnaryInstruction(Type *Ty, unsigned iType, Value *V,
                    Instruction *IB = nullptr)
     : Instruction(Ty, iType, &Op<0>(), 1, IB) {
@@ -141,12 +141,12 @@ public:
     return Create(Instruction::OPC, V, Name, BB);\
   }
 #include "llvm/IR/Instruction.def"
-#define HANDLE_UNARY_INST(N, OPC, CLASS) \
-  LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead", \
-    "BasicBlock::iterator") \
-  static UnaryOperator *Create##OPC(Value *V, const Twine &Name, \
-                                    Instruction *I) {\
-    return Create(Instruction::OPC, V, Name, I);\
+#define HANDLE_UNARY_INST(N, OPC, CLASS)                                       \
+  LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",           \
+                  "BasicBlock::iterator")                                      \
+  static UnaryOperator *Create##OPC(Value *V, const Twine &Name,               \
+                                    Instruction *I) {                          \
+    return Create(Instruction::OPC, V, Name, I);                               \
   }
 #include "llvm/IR/Instruction.def"
 #define HANDLE_UNARY_INST(N, OPC, CLASS) \
@@ -233,12 +233,12 @@ public:
     return Create(Instruction::OPC, V1, V2, Name, BB);\
   }
 #include "llvm/IR/Instruction.def"
-#define HANDLE_BINARY_INST(N, OPC, CLASS) \
-  LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead", \
-    "BasicBlock::iterator") \
-  static BinaryOperator *Create##OPC(Value *V1, Value *V2, \
-                                     const Twine &Name, Instruction *I) {\
-    return Create(Instruction::OPC, V1, V2, Name, I);\
+#define HANDLE_BINARY_INST(N, OPC, CLASS)                                      \
+  LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",           \
+                  "BasicBlock::iterator")                                      \
+  static BinaryOperator *Create##OPC(Value *V1, Value *V2, const Twine &Name,  \
+                                     Instruction *I) {                         \
+    return Create(Instruction::OPC, V1, V2, Name, I);                          \
   }
 #include "llvm/IR/Instruction.def"
 #define HANDLE_BINARY_INST(N, OPC, CLASS) \
@@ -322,7 +322,7 @@ public:
     return BO;
   }
   LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
-    "BasicBlock::iterator")
+                  "BasicBlock::iterator")
   static BinaryOperator *CreateNSW(BinaryOps Opc, Value *V1, Value *V2,
                                    const Twine &Name, Instruction *I) {
     BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
@@ -349,7 +349,7 @@ public:
     return BO;
   }
   LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
-    "BasicBlock::iterator")
+                  "BasicBlock::iterator")
   static BinaryOperator *CreateNUW(BinaryOps Opc, Value *V1, Value *V2,
                                    const Twine &Name, Instruction *I) {
     BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
@@ -376,7 +376,7 @@ public:
     return BO;
   }
   LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
-    "BasicBlock::iterator")
+                  "BasicBlock::iterator")
   static BinaryOperator *CreateExact(BinaryOps Opc, Value *V1, Value *V2,
                                      const Twine &Name, Instruction *I) {
     BinaryOperator *BO = Create(Opc, V1, V2, Name, I);
@@ -413,7 +413,7 @@ public:
     return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, BB);            \
   }                                                                            \
   LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",           \
-      "BasicBlock::iterator")                                                  \
+                  "BasicBlock::iterator")                                      \
   static BinaryOperator *Create##NUWNSWEXACT##OPC(                             \
       Value *V1, Value *V2, const Twine &Name, Instruction *I) {               \
     return Create##NUWNSWEXACT(Instruction::OPC, V1, V2, Name, I);             \
@@ -517,7 +517,7 @@ BinaryOperator *BinaryOperator::CreateDisjoint(BinaryOps Opc, Value *V1,
   return BO;
 }
 LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
-"BasicBlock::iterator")
+                "BasicBlock::iterator")
 BinaryOperator *BinaryOperator::CreateDisjoint(BinaryOps Opc, Value *V1,
                                                Value *V2, const Twine &Name,
                                                Instruction *I) {
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index 569346f037..f29c7dcd7f 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -53,7 +53,7 @@ class InsertPosition {
 public:
   InsertPosition(std::nullptr_t) : InsertAt() {}
   LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
-    "BasicBlock::iterator")
+                  "BasicBlock::iterator")
   InsertPosition(Instruction *InsertBefore);
   InsertPosition(BasicBlock *InsertAtEnd);
   InsertPosition(InstListType::iterator InsertAt) : InsertAt(InsertAt) {}
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index c3c156e266..b6d4d1266b 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -2537,7 +2537,7 @@ public:
   /// edges that this phi node will have (use 0 if you really have no idea).
   static PHINode *Create(Type *Ty, unsigned NumReservedValues,
                          const Twine &NameStr = "",
-                         InsertPosition InsertBefore = (BasicBlock*)nullptr) {
+                         InsertPosition InsertBefore = (BasicBlock *)nullptr) {
     return new PHINode(Ty, NumReservedValues, NameStr, InsertBefore);
   }
 
diff --git a/llvm/lib/SandboxIR/SandboxIR.cpp b/llvm/lib/SandboxIR/SandboxIR.cpp
index e48f025cea..64b16fbd80 100644
--- a/llvm/lib/SandboxIR/SandboxIR.cpp
+++ b/llvm/lib/SandboxIR/SandboxIR.cpp
@@ -1142,7 +1142,8 @@ PHINode *PHINode::create(Type *Ty, unsigned NumReservedValues,
                          Instruction *InsertBefore, Context &Ctx,
                          const Twine &Name) {
   llvm::PHINode *NewPHI = llvm::PHINode::Create(
-      Ty, NumReservedValues, Name, InsertBefore->getTopmostLLVMInstruction()->getIterator());
+      Ty, NumReservedValues, Name,
+      InsertBefore->getTopmostLLVMInstruction()->getIterator());
   return Ctx.createPHINode(NewPHI);
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list