[llvm] [llvm] clang-format llvm/IR/BasicBlock.h and llvmLTO/LTOGodeGenerator.h (PR #141849)
Andrew Rogers via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 13:28:15 PDT 2025
https://github.com/andrurogerz created https://github.com/llvm/llvm-project/pull/141849
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.
>From 8ff1e4f327b690c641007f492ede7b939bfd4e7f Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Wed, 28 May 2025 13:13:43 -0700
Subject: [PATCH 1/2] [llvm] clang-format llvm/LTO/LTOCodeGenerator.h
---
.../llvm/LTO/legacy/LTOCodeGenerator.h | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
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
>From 10c1b665a69e089b713aa4794f906313bd769bcf Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Wed, 28 May 2025 13:15:48 -0700
Subject: [PATCH 2/2] [llvm] clang-format llvm/IR/BasicBlock.h
---
llvm/include/llvm/IR/BasicBlock.h | 66 ++++++++++++++++---------------
1 file changed, 34 insertions(+), 32 deletions(-)
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.
More information about the llvm-commits
mailing list