Skip to content

Commit 5817d9a

Browse files
committed
Address codereview comments
1 parent 696541d commit 5817d9a

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

clang/include/clang/CIR/Dialect/IR/CIRAttrs.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
280280
// ConstComplexAttr
281281
//===----------------------------------------------------------------------===//
282282

283-
def ConstComplexAttr : CIR_Attr<"ConstComplex", "const_complex", [TypedAttrInterface]> {
283+
def ConstComplexAttr : CIR_Attr<"ConstComplex", "const_complex",
284+
[TypedAttrInterface]> {
284285
let summary = "An attribute that contains a constant complex value";
285286
let description = [{
286287
The `#cir.const_complex` attribute contains a constant value of complex number

clang/lib/CIR/CodeGen/CIRGenTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ mlir::Type CIRGenTypes::convertType(QualType type) {
386386
}
387387

388388
case Type::Complex: {
389-
const ComplexType *ct = cast<ComplexType>(ty);
389+
const auto *ct = mlir::cast<clang::ComplexType>(ty);
390390
mlir::Type elementTy = convertType(ct->getElementType());
391391
resultType = cir::ComplexType::get(elementTy);
392392
break;

clang/lib/CIR/Dialect/IR/CIRDialect.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ static LogicalResult checkConstantTypes(mlir::Operation *op, mlir::Type opType,
234234
if (isa<cir::RecordType, cir::ArrayType, cir::VectorType, cir::ComplexType>(
235235
opType))
236236
return success();
237-
return op->emitOpError("zero expects struct or array type");
237+
return op->emitOpError(
238+
"zero expects struct, array, vector or complex type");
238239
}
239240

240241
if (mlir::isa<cir::BoolAttr>(attrType)) {

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ mlir::Value CIRAttrToValue::visitCirAttr(cir::FPAttr fltAttr) {
237237
/// ConstComplexAttr visitor.
238238
mlir::Value CIRAttrToValue::visitCirAttr(cir::ConstComplexAttr complexAttr) {
239239
auto complexType = mlir::cast<cir::ComplexType>(complexAttr.getType());
240-
auto complexElemTy = complexType.getElementType();
241-
auto complexElemLLVMTy = converter->convertType(complexElemTy);
240+
mlir::Type complexElemTy = complexType.getElementType();
241+
mlir::Type complexElemLLVMTy = converter->convertType(complexElemTy);
242242

243243
mlir::Attribute components[2];
244244
if (const auto intType = mlir::dyn_cast<cir::IntType>(complexElemTy)) {

0 commit comments

Comments
 (0)