[clang] [CIR][NFC] Fix CIR build after CharUnits change (PR #161580)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 1 13:33:31 PDT 2025


https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/161580

My previous attempt to fix this missed one case.

>From 2f181c18fa50ab374ac71d534b00bc212908fb89 Mon Sep 17 00:00:00 2001
From: Andy Kaylor <akaylor at nvidia.com>
Date: Wed, 1 Oct 2025 13:31:53 -0700
Subject: [PATCH] [CIR][NFC] Fix CIR build after CharUnits change

My previous attempt to fix this missed one case.
---
 clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp b/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
index bf812c8a1793b..2baeb43c48b2e 100644
--- a/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
@@ -824,7 +824,7 @@ void CIRRecordLowering::lowerUnion() {
     appendPaddingBytes(layoutSize - getSize(storageType));
 
   // Set packed if we need it.
-  if (layoutSize % getAlignment(storageType))
+  if (!layoutSize.isMultipleOf(getAlignment(storageType)))
     packed = true;
 }
 



More information about the cfe-commits mailing list