Skip to content

Commit

Permalink
minor changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
gitoleg committed Jan 9, 2025
1 parent 70d134a commit 6b1f369
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions clang/lib/CIR/CodeGen/CIRGenExprConst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using namespace clang::CIRGen;
namespace {
class ConstExprEmitter;

mlir::TypedAttr getPadding(CIRGenModule &CGM, CharUnits size) {
static mlir::TypedAttr computePadding(CIRGenModule &CGM, CharUnits size) {
auto eltTy = CGM.UCharTy;
auto arSize = size.getQuantity();
auto &bld = CGM.getBuilder();
Expand Down Expand Up @@ -83,7 +83,7 @@ struct ConstantAggregateBuilderUtils {
}

mlir::TypedAttr getPadding(CharUnits size) const {
return ::getPadding(CGM, size);
return computePadding(CGM, size);
}

mlir::Attribute getZeroes(CharUnits ZeroSize) const {
Expand Down Expand Up @@ -517,7 +517,7 @@ class ConstStructBuilder {
bool Build(const APValue &Val, const RecordDecl *RD, bool IsPrimaryBase,
const CXXRecordDecl *VTableClass, CharUnits BaseOffset);

bool DoZeroInitPadding(const ASTRecordLayout &Layout, unsigned FieldNo,
bool ApplyZeroInitPadding(const ASTRecordLayout &Layout, unsigned FieldNo,
const FieldDecl &Field, bool AllowOverwrite,
CharUnits &SizeSoFar, bool &ZeroFieldSize);

Expand Down Expand Up @@ -660,7 +660,7 @@ bool ConstStructBuilder::Build(InitListExpr *ILE, bool AllowOverwrite) {
}

if (ZeroInitPadding &&
!DoZeroInitPadding(Layout, FieldNo, *Field, AllowOverwrite, SizeSoFar,
!ApplyZeroInitPadding(Layout, FieldNo, *Field, AllowOverwrite, SizeSoFar,
ZeroFieldSize))
return false;

Expand Down Expand Up @@ -806,15 +806,15 @@ bool ConstStructBuilder::Build(const APValue &Val, const RecordDecl *RD,
return true;
}

bool ConstStructBuilder::DoZeroInitPadding(
bool ConstStructBuilder::ApplyZeroInitPadding(
const ASTRecordLayout &Layout, unsigned FieldNo, const FieldDecl &Field,
bool AllowOverwrite, CharUnits &SizeSoFar, bool &ZeroFieldSize) {

uint64_t StartBitOffset = Layout.getFieldOffset(FieldNo);
CharUnits StartOffset =
CGM.getASTContext().toCharUnitsFromBits(StartBitOffset);
if (SizeSoFar < StartOffset) {
if (!AppendBytes(SizeSoFar, getPadding(CGM, StartOffset - SizeSoFar),
if (!AppendBytes(SizeSoFar, computePadding(CGM, StartOffset - SizeSoFar),
AllowOverwrite))
return false;
}
Expand Down

0 comments on commit 6b1f369

Please sign in to comment.