[clang] [clang][CodeGen] `used` globals && the payloads for global ctors & dtors are globals (PR #93601)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 28 12:24:01 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 a487616cbf542826d0ba1e7d0dabedca33a27de8 34b9646a38c6bdd0419dd9d2eb1bc847c4d16596 -- clang/lib/CodeGen/CodeGenModule.cpp clang/test/CodeGen/2005-12-04-AttributeUsed.c clang/test/CodeGen/attr-retain.c clang/test/CodeGenCXX/attr-retain.cpp clang/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp clang/test/OpenMP/amdgcn_target_global_constructor.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 30a18b1c5e..4346ea7b1b 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2048,8 +2048,8 @@ void CodeGenModule::EmitCtorList(CtorList &Fns, const char *GlobalName) {
TheModule.getDataLayout().getProgramAddressSpace());
// Get the type of a ctor entry, { i32, program void ()*, global i8* }.
- llvm::StructType *CtorStructTy = llvm::StructType::get(
- Int32Ty, CtorPFTy, GlobalsInt8PtrTy);
+ llvm::StructType *CtorStructTy =
+ llvm::StructType::get(Int32Ty, CtorPFTy, GlobalsInt8PtrTy);
// Construct the constructor and destructor arrays.
ConstantInitBuilder builder(*this);
@@ -2926,15 +2926,14 @@ static void emitUsed(CodeGenModule &CGM, StringRef Name,
SmallVector<llvm::Constant*, 8> UsedArray;
UsedArray.resize(List.size());
for (unsigned i = 0, e = List.size(); i != e; ++i) {
- UsedArray[i] =
- llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
- cast<llvm::Constant>(&*List[i]), CGM.GlobalsInt8PtrTy);
+ UsedArray[i] = llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
+ cast<llvm::Constant>(&*List[i]), CGM.GlobalsInt8PtrTy);
}
if (UsedArray.empty())
return;
- llvm::ArrayType *ATy = llvm::ArrayType::get(CGM.GlobalsInt8PtrTy,
- UsedArray.size());
+ llvm::ArrayType *ATy =
+ llvm::ArrayType::get(CGM.GlobalsInt8PtrTy, UsedArray.size());
auto *GV = new llvm::GlobalVariable(
CGM.getModule(), ATy, false, llvm::GlobalValue::AppendingLinkage,
``````````
</details>
https://github.com/llvm/llvm-project/pull/93601
More information about the cfe-commits
mailing list