[clang] [UBSAN] add null and alignment checks for aggregates (PR #164548)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 22 00:10:34 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 origin/main HEAD --extensions cpp -- clang/lib/CodeGen/CGExprAgg.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/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index de6d80a27..1d6e3c101 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -2254,14 +2254,12 @@ void CodeGenFunction::EmitAggregateCopy(LValue Dest, LValue Src, QualType Ty,
     Address DestAddr = Dest.getAddress();
 
     // Check source pointer for null and alignment violations
-    EmitTypeCheck(TCK_Load, SourceLocation(),
-                  SrcAddr.emitRawPointer(*this), Ty, SrcAddr.getAlignment(),
-                  SanitizerSet());
+    EmitTypeCheck(TCK_Load, SourceLocation(), SrcAddr.emitRawPointer(*this), Ty,
+                  SrcAddr.getAlignment(), SanitizerSet());
 
     // Check destination pointer for null and alignment violations
-    EmitTypeCheck(TCK_Store, SourceLocation(),
-                  DestAddr.emitRawPointer(*this), Ty, DestAddr.getAlignment(),
-                  SanitizerSet());
+    EmitTypeCheck(TCK_Store, SourceLocation(), DestAddr.emitRawPointer(*this),
+                  Ty, DestAddr.getAlignment(), SanitizerSet());
   }
 
   Address DestPtr = Dest.getAddress();

``````````

</details>


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


More information about the cfe-commits mailing list