@@ -173,7 +173,7 @@ Type StructType::parse(mlir::AsmParser &parser) {
173
173
174
174
if (parser.parseOptionalKeyword (" packed" ).succeeded ())
175
175
packed = true ;
176
-
176
+
177
177
if (parser.parseOptionalKeyword (" padded" ).succeeded ())
178
178
padded = true ;
179
179
@@ -273,7 +273,8 @@ void StructType::print(mlir::AsmPrinter &printer) const {
273
273
mlir::LogicalResult StructType::verifyInvariants (
274
274
llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
275
275
llvm::ArrayRef<mlir::Type> members, mlir::StringAttr name, bool incomplete,
276
- bool packed, bool padded, cir::StructType::RecordKind kind, ASTRecordDeclInterface ast) {
276
+ bool packed, bool padded, cir::StructType::RecordKind kind,
277
+ ASTRecordDeclInterface ast) {
277
278
if (name && name.getValue ().empty ()) {
278
279
emitError () << " identified structs cannot have an empty name" ;
279
280
return mlir::failure ();
@@ -283,10 +284,10 @@ mlir::LogicalResult StructType::verifyInvariants(
283
284
284
285
void StructType::dropAst () { getImpl ()->ast = nullptr ; }
285
286
StructType StructType::get (::mlir::MLIRContext *context, ArrayRef<Type> members,
286
- StringAttr name, bool packed, bool padded, RecordKind kind,
287
- ASTRecordDeclInterface ast) {
288
- return Base::get (context, members, name, /* incomplete=*/ false , packed, padded, kind,
289
- ast);
287
+ StringAttr name, bool packed, bool padded,
288
+ RecordKind kind, ASTRecordDeclInterface ast) {
289
+ return Base::get (context, members, name, /* incomplete=*/ false , packed, padded,
290
+ kind, ast);
290
291
}
291
292
292
293
StructType StructType::getChecked (
@@ -300,16 +301,17 @@ StructType StructType::getChecked(
300
301
StructType StructType::get (::mlir::MLIRContext *context, StringAttr name,
301
302
RecordKind kind) {
302
303
return Base::get (context, /* members=*/ ArrayRef<Type>{}, name,
303
- /* incomplete=*/ true , /* packed=*/ false , /* padded=*/ false , kind,
304
+ /* incomplete=*/ true , /* packed=*/ false , /* padded=*/ false ,
305
+ kind,
304
306
/* ast=*/ ASTRecordDeclInterface{});
305
307
}
306
308
307
309
StructType StructType::getChecked (
308
310
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError,
309
311
::mlir::MLIRContext *context, StringAttr name, RecordKind kind) {
310
312
return Base::getChecked (emitError, context, ArrayRef<Type>{}, name,
311
- /* incomplete=*/ true , /* packed=*/ false , /* padded= */ false , kind,
312
- ASTRecordDeclInterface{});
313
+ /* incomplete=*/ true , /* packed=*/ false ,
314
+ /* padded= */ false , kind, ASTRecordDeclInterface{});
313
315
}
314
316
315
317
StructType StructType::get (::mlir::MLIRContext *context, ArrayRef<Type> members,
@@ -324,8 +326,7 @@ StructType StructType::getChecked(
324
326
::mlir::MLIRContext *context, ArrayRef<Type> members, bool packed,
325
327
bool padded, RecordKind kind, ASTRecordDeclInterface ast) {
326
328
return Base::getChecked (emitError, context, members, StringAttr{},
327
- /* incomplete=*/ false , packed, padded,
328
- kind, ast);
329
+ /* incomplete=*/ false , packed, padded, kind, ast);
329
330
}
330
331
331
332
::llvm::ArrayRef<mlir::Type> StructType::getMembers () const {
@@ -527,10 +528,10 @@ void StructType::computeSizeAndAlignment(
527
528
bool dontCountLastElt = isUnion () && getPadded ();
528
529
if (dontCountLastElt)
529
530
numElements--;
530
-
531
+
531
532
// Loop over each of the elements, placing them in memory.
532
533
memberOffsets.reserve (numElements);
533
-
534
+
534
535
for (unsigned i = 0 , e = numElements; i != e; ++i) {
535
536
auto ty = members[i];
536
537
@@ -571,7 +572,7 @@ void StructType::computeSizeAndAlignment(
571
572
structSize = largestMemberSize;
572
573
if (getPadded ()) {
573
574
memberOffsets.push_back (mlir::IntegerAttr::get (
574
- mlir::IntegerType::get (getContext (), 32 ), structSize));
575
+ mlir::IntegerType::get (getContext (), 32 ), structSize));
575
576
auto ty = getMembers ()[numElements];
576
577
structSize += dataLayout.getTypeSize (ty);
577
578
isPadded = true ;
@@ -1067,9 +1068,8 @@ static mlir::Type getMethodLayoutType(mlir::MLIRContext *ctx) {
1067
1068
// TODO: consider member function pointer layout in other ABIs
1068
1069
auto voidPtrTy = cir::PointerType::get (cir::VoidType::get (ctx));
1069
1070
mlir::Type fields[2 ]{voidPtrTy, voidPtrTy};
1070
- return cir::StructType::get (ctx, fields, /* packed=*/ false ,
1071
- /* padded=*/ false ,
1072
- cir::StructType::Struct);
1071
+ return cir::StructType::get (ctx, fields, /* packed=*/ false ,
1072
+ /* padded=*/ false , cir::StructType::Struct);
1073
1073
}
1074
1074
1075
1075
llvm::TypeSize
0 commit comments