[llvm] Remove GlobalObject::getAlign/setAlignment (PR #143188)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 11:26:08 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,h -- llvm/include/llvm/IR/Function.h llvm/include/llvm/IR/GlobalObject.h llvm/include/llvm/IR/GlobalVariable.h llvm/include/llvm/SandboxIR/Constant.h llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/lib/IR/Core.cpp llvm/lib/IR/IRBuilder.cpp llvm/lib/IR/Value.cpp llvm/lib/IR/Verifier.cpp llvm/lib/LTO/LTOModule.cpp llvm/lib/SandboxIR/Constant.cpp llvm/lib/Target/PowerPC/PPCMIPeephole.cpp llvm/lib/Target/SystemZ/SystemZSubtarget.cpp llvm/lib/Transforms/Utils/Local.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index 47c7bec1a..c2510ea75 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -1042,22 +1042,16 @@ public:
   ///
   /// Note that this is the alignment of the code, not the alignment of a
   /// function pointer.
-  MaybeAlign getAlign() const {
-    return GlobalObject::getAlign();
-  }
+  MaybeAlign getAlign() const { return GlobalObject::getAlign(); }
 
   /// Sets the alignment attribute of the Function.
-  void setAlignment(Align Align) {
-    GlobalObject::setAlignment(Align);
-  }
+  void setAlignment(Align Align) { GlobalObject::setAlignment(Align); }
 
   /// Sets the alignment attribute of the Function.
   ///
   /// This method will be deprecated as the alignment property should always be
   /// defined.
-  void setAlignment(MaybeAlign Align) {
-    GlobalObject::setAlignment(Align);
-  }
+  void setAlignment(MaybeAlign Align) { GlobalObject::setAlignment(Align); }
 
 private:
   void allocHungoffUselist();
diff --git a/llvm/include/llvm/IR/GlobalVariable.h b/llvm/include/llvm/IR/GlobalVariable.h
index 3b64758df..388e1d7cf 100644
--- a/llvm/include/llvm/IR/GlobalVariable.h
+++ b/llvm/include/llvm/IR/GlobalVariable.h
@@ -305,21 +305,15 @@ public:
   }
 
   /// Returns the alignment of the given variable.
-  MaybeAlign getAlign() const {
-    return GlobalObject::getAlign();
-  }
+  MaybeAlign getAlign() const { return GlobalObject::getAlign(); }
 
   /// Sets the alignment attribute of the GlobalVariable.
-  void setAlignment(Align Align) {
-    GlobalObject::setAlignment(Align);
-  }
+  void setAlignment(Align Align) { GlobalObject::setAlignment(Align); }
 
   /// Sets the alignment attribute of the GlobalVariable.
   /// This method will be deprecated as the alignment property should always be
   /// defined.
-  void setAlignment(MaybeAlign Align) {
-    GlobalObject::setAlignment(Align);
-  }
+  void setAlignment(MaybeAlign Align) { GlobalObject::setAlignment(Align); }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static bool classof(const Value *V) {
diff --git a/llvm/lib/SandboxIR/Constant.cpp b/llvm/lib/SandboxIR/Constant.cpp
index 5779a1c77..82cf0876d 100644
--- a/llvm/lib/SandboxIR/Constant.cpp
+++ b/llvm/lib/SandboxIR/Constant.cpp
@@ -284,9 +284,8 @@ PoisonValue *PoisonValue::getElementValue(unsigned Idx) const {
 
 void GlobalVariable::setAlignment(MaybeAlign Align) {
   Ctx.getTracker()
-      .emplaceIfTracking<
-          GenericSetter<&GlobalVariable::getAlign, &GlobalVariable::setAlignment>>(
-          this);
+      .emplaceIfTracking<GenericSetter<&GlobalVariable::getAlign,
+                                       &GlobalVariable::setAlignment>>(this);
   cast<llvm::GlobalVariable>(Val)->setAlignment(Align);
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list