[clang] [CIR][NFC] Fix CIR build (PR #161577)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 1 13:18:06 PDT 2025
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/161577
This fixes the CIR build after recent changes to CharUnits.
>From 56c7e1737814515c2cf7992302b1040e043d78af Mon Sep 17 00:00:00 2001
From: Andy Kaylor <akaylor at nvidia.com>
Date: Wed, 1 Oct 2025 13:12:58 -0700
Subject: [PATCH] [CIR][NFC] Fix CIR build
This fixes the CIR build after recent changes to CharUnits.
---
clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp b/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
index a7628816089d0..bf812c8a1793b 100644
--- a/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
@@ -615,7 +615,7 @@ void CIRRecordLowering::determinePacked(bool nvBaseType) {
continue;
// If any member falls at an offset that it not a multiple of its alignment,
// then the entire record must be packed.
- if (member.offset % getAlignment(member.data))
+ if (!member.offset.isMultipleOf(getAlignment(member.data)))
packed = true;
if (member.offset < nvSize)
nvAlignment = std::max(nvAlignment, getAlignment(member.data));
@@ -623,12 +623,12 @@ void CIRRecordLowering::determinePacked(bool nvBaseType) {
}
// If the size of the record (the capstone's offset) is not a multiple of the
// record's alignment, it must be packed.
- if (members.back().offset % alignment)
+ if (!members.back().offset.isMultipleOf(alignment))
packed = true;
// If the non-virtual sub-object is not a multiple of the non-virtual
// sub-object's alignment, it must be packed. We cannot have a packed
// non-virtual sub-object and an unpacked complete object or vise versa.
- if (nvSize % nvAlignment)
+ if (!nvSize.isMultipleOf(nvAlignment))
packed = true;
// Update the alignment of the sentinel.
if (!packed)
More information about the cfe-commits
mailing list