[clang] [clang] Only set the trailing bytes to zero when filling a partially … (PR #79502)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 25 22:58:52 PST 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 e99edf6bcb20169e153110426f840a2dfeeec66d e2231f4de6e835618cf30b0bab6b3cc72839dc94 -- clang/lib/CodeGen/CGDecl.cpp clang/test/CodeGenCXX/trivial-auto-var-init.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index e5a2561502..bc03909c1c 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -905,8 +905,8 @@ void CodeGenFunction::EmitScalarInit(const Expr *init, const ValueDecl *D,
   EmitStoreOfScalar(value, lvalue, /* isInitialization */ true);
 }
 
-static size_t
-CountLeadingNonNullBytes(const llvm::DataLayout &DL, llvm::Constant *Init) {
+static size_t CountLeadingNonNullBytes(const llvm::DataLayout &DL,
+                                       llvm::Constant *Init) {
   // Zero and Undef never requires any extra stores.
   if (Init->isNullValue() || isa<llvm::ConstantAggregateZero>(Init) ||
       isa<llvm::ConstantPointerNull>(Init) || isa<llvm::UndefValue>(Init))

``````````

</details>


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


More information about the cfe-commits mailing list