Skip to content

Commit ec9fb3c

Browse files
committed
Address codereview comments
1 parent 404e7d8 commit ec9fb3c

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
@@ -388,7 +388,7 @@ mlir::Type CIRGenTypes::convertType(QualType type) {
388388
}
389389

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

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

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

239240
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)