Skip to content

[llvm] clang-format llvm/IR/BasicBlock.h and llvmLTO/LTOGodeGenerator.h #141849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 2, 2025

Conversation

andrurogerz
Copy link
Contributor

@andrurogerz andrurogerz commented May 28, 2025

Reformat a couple of headers under llvm/include with clang-format in preparation for a codemod.

This is just a formatting change; no functionality is impacted.

@llvmbot
Copy link
Member

llvmbot commented May 28, 2025

@llvm/pr-subscribers-llvm-ir

Author: Andrew Rogers (andrurogerz)

Changes

Reformat a couple of headers files under llvm/include/llvm with clang-format in preparation for a codemod.

This is just a formatting change; no functionality is impacted.


Full diff: https://github.com/llvm/llvm-project/pull/141849.diff

2 Files Affected:

  • (modified) llvm/include/llvm/IR/BasicBlock.h (+34-32)
  • (modified) llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h (+10-10)
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index 9ee0bacb5c258..6e62b88768cee 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -218,7 +218,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
 
   /// Return the enclosing method, or null if none.
   const Function *getParent() const { return Parent; }
-        Function *getParent()       { return Parent; }
+  Function *getParent() { return Parent; }
 
   /// Return the module owning the function this basic block belongs to, or
   /// nullptr if the function does not have a module.
@@ -227,7 +227,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const Module *getModule() const;
   Module *getModule() {
     return const_cast<Module *>(
-                            static_cast<const BasicBlock *>(this)->getModule());
+        static_cast<const BasicBlock *>(this)->getModule());
   }
 
   /// Get the data layout of the module this basic block belongs to.
@@ -253,16 +253,17 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const CallInst *getTerminatingDeoptimizeCall() const;
   CallInst *getTerminatingDeoptimizeCall() {
     return const_cast<CallInst *>(
-         static_cast<const BasicBlock *>(this)->getTerminatingDeoptimizeCall());
+        static_cast<const BasicBlock *>(this)->getTerminatingDeoptimizeCall());
   }
 
   /// Returns the call instruction calling \@llvm.experimental.deoptimize
   /// that is present either in current basic block or in block that is a unique
-  /// successor to current block, if such call is present. Otherwise, returns null.
+  /// successor to current block, if such call is present. Otherwise, returns
+  /// null.
   const CallInst *getPostdominatingDeoptimizeCall() const;
   CallInst *getPostdominatingDeoptimizeCall() {
-    return const_cast<CallInst *>(
-         static_cast<const BasicBlock *>(this)->getPostdominatingDeoptimizeCall());
+    return const_cast<CallInst *>(static_cast<const BasicBlock *>(this)
+                                      ->getPostdominatingDeoptimizeCall());
   }
 
   /// Returns the call instruction marked 'musttail' prior to the terminating
@@ -271,7 +272,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const CallInst *getTerminatingMustTailCall() const;
   CallInst *getTerminatingMustTailCall() {
     return const_cast<CallInst *>(
-           static_cast<const BasicBlock *>(this)->getTerminatingMustTailCall());
+        static_cast<const BasicBlock *>(this)->getTerminatingMustTailCall());
   }
 
   /// Returns a pointer to the first instruction in this block that is not a
@@ -336,7 +337,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const_iterator getFirstInsertionPt() const;
   iterator getFirstInsertionPt() {
     return static_cast<const BasicBlock *>(this)
-                                          ->getFirstInsertionPt().getNonConst();
+        ->getFirstInsertionPt()
+        .getNonConst();
   }
 
   /// Returns an iterator to the first instruction in this block that is
@@ -351,10 +353,10 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   /// Returns the first potential AsynchEH faulty instruction
   /// currently it checks for loads/stores (which may dereference a null
   /// pointer) and calls/invokes (which may propagate exceptions)
-  const Instruction* getFirstMayFaultInst() const;
-  Instruction* getFirstMayFaultInst() {
-      return const_cast<Instruction*>(
-          static_cast<const BasicBlock*>(this)->getFirstMayFaultInst());
+  const Instruction *getFirstMayFaultInst() const;
+  Instruction *getFirstMayFaultInst() {
+    return const_cast<Instruction *>(
+        static_cast<const BasicBlock *>(this)->getFirstMayFaultInst());
   }
 
   /// Return a const iterator range over the instructions in the block, skipping
@@ -408,7 +410,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const BasicBlock *getSinglePredecessor() const;
   BasicBlock *getSinglePredecessor() {
     return const_cast<BasicBlock *>(
-                 static_cast<const BasicBlock *>(this)->getSinglePredecessor());
+        static_cast<const BasicBlock *>(this)->getSinglePredecessor());
   }
 
   /// Return the predecessor of this block if it has a unique predecessor
@@ -420,7 +422,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const BasicBlock *getUniquePredecessor() const;
   BasicBlock *getUniquePredecessor() {
     return const_cast<BasicBlock *>(
-                 static_cast<const BasicBlock *>(this)->getUniquePredecessor());
+        static_cast<const BasicBlock *>(this)->getUniquePredecessor());
   }
 
   /// Return true if this block has exactly N predecessors.
@@ -436,7 +438,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const BasicBlock *getSingleSuccessor() const;
   BasicBlock *getSingleSuccessor() {
     return const_cast<BasicBlock *>(
-                   static_cast<const BasicBlock *>(this)->getSingleSuccessor());
+        static_cast<const BasicBlock *>(this)->getSingleSuccessor());
   }
 
   /// Return the successor of this block if it has a unique successor.
@@ -446,7 +448,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const BasicBlock *getUniqueSuccessor() const;
   BasicBlock *getUniqueSuccessor() {
     return const_cast<BasicBlock *>(
-                   static_cast<const BasicBlock *>(this)->getUniqueSuccessor());
+        static_cast<const BasicBlock *>(this)->getUniqueSuccessor());
   }
 
   /// Print the basic block to an output stream with an optional
@@ -471,20 +473,20 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
     It.setHeadBit(true);
     return It;
   }
-  inline iterator                end  ()       { return InstList.end();   }
-  inline const_iterator          end  () const { return InstList.end();   }
+  inline iterator end() { return InstList.end(); }
+  inline const_iterator end() const { return InstList.end(); }
 
-  inline reverse_iterator        rbegin()       { return InstList.rbegin(); }
-  inline const_reverse_iterator  rbegin() const { return InstList.rbegin(); }
-  inline reverse_iterator        rend  ()       { return InstList.rend();   }
-  inline const_reverse_iterator  rend  () const { return InstList.rend();   }
+  inline reverse_iterator rbegin() { return InstList.rbegin(); }
+  inline const_reverse_iterator rbegin() const { return InstList.rbegin(); }
+  inline reverse_iterator rend() { return InstList.rend(); }
+  inline const_reverse_iterator rend() const { return InstList.rend(); }
 
-  inline size_t                   size() const { return InstList.size();  }
-  inline bool                    empty() const { return InstList.empty(); }
-  inline const Instruction      &front() const { return InstList.front(); }
-  inline       Instruction      &front()       { return InstList.front(); }
-  inline const Instruction       &back() const { return InstList.back();  }
-  inline       Instruction       &back()       { return InstList.back();  }
+  inline size_t size() const { return InstList.size(); }
+  inline bool empty() const { return InstList.empty(); }
+  inline const Instruction &front() const { return InstList.front(); }
+  inline Instruction &front() { return InstList.front(); }
+  inline const Instruction &back() const { return InstList.back(); }
+  inline Instruction &back() { return InstList.back(); }
 
   /// Iterator to walk just the phi nodes in the basic block.
   template <typename PHINodeT = PHINode, typename BBIteratorT = iterator>
@@ -677,12 +679,12 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   /// Transfer a range of instructions that belong to \p FromBB from \p
   /// FromBeginIt to \p FromEndIt, to this basic block at \p ToIt.
   void splice(BasicBlock::iterator ToIt, BasicBlock *FromBB,
-              BasicBlock::iterator FromBeginIt,
-              BasicBlock::iterator FromEndIt);
+              BasicBlock::iterator FromBeginIt, BasicBlock::iterator FromEndIt);
 
   /// Erases a range of instructions from \p FromIt to (not including) \p ToIt.
   /// \Returns \p ToIt.
-  BasicBlock::iterator erase(BasicBlock::iterator FromIt, BasicBlock::iterator ToIt);
+  BasicBlock::iterator erase(BasicBlock::iterator FromIt,
+                             BasicBlock::iterator ToIt);
 
   /// Returns true if there are any uses of this basic block other than
   /// direct branches, switches, etc. to it.
@@ -715,7 +717,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
   const LandingPadInst *getLandingPadInst() const;
   LandingPadInst *getLandingPadInst() {
     return const_cast<LandingPadInst *>(
-                    static_cast<const BasicBlock *>(this)->getLandingPadInst());
+        static_cast<const BasicBlock *>(this)->getLandingPadInst());
   }
 
   /// Return true if it is legal to hoist instructions into this block.
diff --git a/llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h b/llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h
index d8e41fe922581..9379bf4ddfeeb 100644
--- a/llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h
@@ -53,15 +53,15 @@
 
 namespace llvm {
 template <typename T> class ArrayRef;
-  class LLVMContext;
-  class DiagnosticInfo;
-  class Linker;
-  class Mangler;
-  class MemoryBuffer;
-  class TargetLibraryInfo;
-  class TargetMachine;
-  class raw_ostream;
-  class raw_pwrite_stream;
+class LLVMContext;
+class DiagnosticInfo;
+class Linker;
+class Mangler;
+class MemoryBuffer;
+class TargetLibraryInfo;
+class TargetMachine;
+class raw_ostream;
+class raw_pwrite_stream;
 
 /// Enable global value internalization in LTO.
 extern cl::opt<bool> EnableLTOInternalization;
@@ -253,5 +253,5 @@ struct LTOCodeGenerator {
 /// A convenience function that calls cl::ParseCommandLineOptions on the given
 /// set of options.
 void parseCommandLineOptions(std::vector<std::string> &Options);
-}
+} // namespace llvm
 #endif

@compnerd compnerd merged commit 4ca4f81 into llvm:main Jun 2, 2025
11 checks passed
@andrurogerz andrurogerz deleted the llvm-clang-format branch June 2, 2025 16:39
sallto pushed a commit to sallto/llvm-project that referenced this pull request Jun 3, 2025
….h (llvm#141849)

Reformat a couple of headers under llvm/include with `clang-format` in
preparation for a codemod.

This is just a formatting change; no functionality is impacted.
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
….h (llvm#141849)

Reformat a couple of headers under llvm/include with `clang-format` in
preparation for a codemod.

This is just a formatting change; no functionality is impacted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants