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 origin/main HEAD --extensions cpp,c,h --
clang/include/clang/CIR/LoweringHelpers.h
clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
clang/lib/CIR/Lowering/LoweringHelpers.cpp clang/test/CIR/CodeGen/bitfields.cpp
clang/test/CIR/CodeGen/union-agg-init.c
clang/test/CIR/CodeGen/union-agg-init.cpp
clang/test/CIR/CodeGen/unions-with-zero-init.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CIR/Lowering/LoweringHelpers.cpp
b/clang/lib/CIR/Lowering/LoweringHelpers.cpp
index db6448ee0..3dc79b3b1 100644
--- a/clang/lib/CIR/Lowering/LoweringHelpers.cpp
+++ b/clang/lib/CIR/Lowering/LoweringHelpers.cpp
@@ -442,8 +442,8 @@ static mlir::Type adjustGlobalStructTypeForInit(
for (auto [idx, member] : llvm::enumerate(initMembers)) {
if (idx >= origBody.size())
break;
- mlir::Type adjusted = adjustGlobalTypeForInit(
- origBody[idx], member, converter, dataLayout);
+ mlir::Type adjusted =
+ adjustGlobalTypeForInit(origBody[idx], member, converter, dataLayout);
unsigned adjustedAlign = dataLayout.getTypeABIAlignment(adjusted);
if (adjusted != origBody[idx]) {
@@ -467,8 +467,7 @@ static mlir::Type adjustGlobalStructTypeForInit(
// alignment between this field and the padding.
uint64_t difference = origOffset - curOffset;
newBody.push_back(mlir::LLVM::LLVMArrayType::get(
- mlir::IntegerType::get(structTy.getContext(), 8),
- difference));
+ mlir::IntegerType::get(structTy.getContext(), 8), difference));
paddingAddedIndexes.push_back(idx);
curOffset = origOffset;
}
@@ -624,15 +623,15 @@ std::optional<mlir::Attribute> lowerConstRecordAttr(
}
// The lowered LLVM type may have more fields than the CIR record has members
- // for a few reasons:
- // 1- a union lowers to { active-member, [pad x i8]).
+ // for a few reasons:
+ // 1- a union lowers to { active-member, [pad x i8]).
// 2- A struct that contains such a union can have its alignment changed too,
// so it needs tail padding to fill that in.
- // 3- A struct containing a union whose initializer doesn't use the
highest-aligned
- // field will have to prepend a bit of padding, such as struct { i32, union {
- // i64, i32 } }. Typically the union gets lowered to a struct { i64 } (as
i64
- // has the greatest alignment), but if the init causes it to be the i32(or
any
- // such smaller field) we have to prepend it with padding:
+ // 3- A struct containing a union whose initializer doesn't use the
+ // highest-aligned field will have to prepend a bit of padding, such as
struct
+ // { i32, union { i64, i32 } }. Typically the union gets lowered to a struct
+ // { i64 } (as i64 has the greatest alignment), but if the init causes it to
+ // be the i32(or any such smaller field) we have to prepend it with padding:
// struct { i32, [4 x i8], struct { i32 }}
// instead of (with no init):
// struct { i32, struct { i64 }}
@@ -646,7 +645,7 @@ std::optional<mlir::Attribute> lowerConstRecordAttr(
// causing problems.
for (unsigned paddedElt : llvm::reverse(paddingAddedIndexes))
loweredMembers.insert(loweredMembers.begin() + paddedElt,
- mlir::LLVM::ZeroAttr::get(constRecord.getContext()));
+ mlir::LLVM::ZeroAttr::get(constRecord.getContext()));
// Any remaining difference will be the union/struct padding case. We don't
// have a great handle/way to tell when to zero-vs-undef init, so always
``````````
</details>
https://github.com/llvm/llvm-project/pull/216349
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits