[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 18:46:55 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 0012b1ea84e671a9e0c9f7f2d1564315ed9cbcca 19f3b677d92ed88b825b455d738055da05f91e0d -- clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGExprAgg.cpp clang/lib/CodeGen/CodeGenFunction.h clang/test/CodeGen/arm-mve-intrinsics/vld24.c clang/test/CodeGen/arm-vfp16-arguments2.cpp clang/test/CodeGenCXX/address-space-cast-coerce.cpp clang/test/CodeGenCXX/cxx2a-consteval.cpp clang/test/CodeGenCXX/trivial_abi.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index db6feb4bf1..262aa30547 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1355,7 +1355,8 @@ void CodeGenFunction::CreateCoercedStore(llvm::Value *Src, Address Dst,
   // FIXME: This isn't really that useful with opaque types, but it impacts a
   // lot of regression tests.
   if (SrcTy != Dst.getElementType()) {
-    if (llvm::StructType *DstSTy = dyn_cast<llvm::StructType>(Dst.getElementType())) {
+    if (llvm::StructType *DstSTy =
+            dyn_cast<llvm::StructType>(Dst.getElementType())) {
       assert(!SrcSize.isScalable());
       Dst = EnterStructPointerForCoercedAccess(Dst, DstSTy,
                                                SrcSize.getFixedValue(), *this);
@@ -1368,7 +1369,8 @@ void CodeGenFunction::CreateCoercedStore(llvm::Value *Src, Address Dst,
       // If the value is supposed to be a pointer, convert it before storing it.
       Src = CoerceIntOrPtrToIntOrPtr(Src, Dst.getElementType(), *this);
       Builder.CreateStore(Src, Dst, DstIsVolatile);
-    } else if (llvm::StructType *STy = dyn_cast<llvm::StructType>(Src->getType())) {
+    } else if (llvm::StructType *STy =
+                   dyn_cast<llvm::StructType>(Src->getType())) {
       // Prefer scalar stores to first-class aggregate stores.
       Dst = Dst.withElementType(SrcTy);
       for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {

``````````

</details>


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


More information about the cfe-commits mailing list