Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions clang/include/clang/CIR/Dialect/IR/CIRTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,14 @@ def CIR_ArrayType : CIR_Type<"Array", "array",

let parameters = (ins "mlir::Type":$eltType, "uint64_t":$size);

let builders = [
TypeBuilderWithInferredContext<(ins
"mlir::Type":$eltType, "uint64_t":$size
), [{
return $_get(eltType.getContext(), eltType, size);
}]>,
];

let assemblyFormat = [{
`<` $eltType `x` $size `>`
}];
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ emitArrayConstant(CIRGenModule &cgm, mlir::Type desiredType,
eles.push_back(element);

return cir::ConstArrayAttr::get(
cir::ArrayType::get(builder.getContext(), commonElementType,
arrayBound),
cir::ArrayType::get(commonElementType, arrayBound),
mlir::ArrayAttr::get(builder.getContext(), eles));
}

Expand Down
3 changes: 1 addition & 2 deletions clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ struct CIRRecordLowering final {
mlir::Type type = getCharType();
return numberOfChars == CharUnits::One()
? type
: cir::ArrayType::get(type.getContext(), type,
numberOfChars.getQuantity());
: cir::ArrayType::get(type, numberOfChars.getQuantity());
}

mlir::Type getStorageType(const FieldDecl *fieldDecl) {
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/CIR/CodeGen/CIRGenTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,7 @@ mlir::Type CIRGenTypes::convertType(QualType type) {
case Type::ConstantArray: {
const ConstantArrayType *arrTy = cast<ConstantArrayType>(ty);
mlir::Type elemTy = convertTypeForMem(arrTy->getElementType());
resultType = cir::ArrayType::get(builder.getContext(), elemTy,
arrTy->getSize().getZExtValue());
resultType = cir::ArrayType::get(elemTy, arrTy->getSize().getZExtValue());
break;
}

Expand Down
Loading