Skip to content

Commit ab35526

Browse files
committed
[CIR] Make UndefAttr use AttrBuilderWithInferredContext
1 parent 53927ab commit ab35526

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ def UndefAttr : CIR_Attr<"Undef", "undef", [TypedAttrInterface]> {
9393
}];
9494

9595
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
96+
97+
let builders = [
98+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
99+
return $_get(type.getContext(), type);
100+
}]>
101+
];
102+
96103
let assemblyFormat = [{}];
97104
}
98105

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ llvm::SmallVector<MemorySlot> cir::AllocaOp::getPromotableSlots() {
3434

3535
Value cir::AllocaOp::getDefaultValue(const MemorySlot &slot,
3636
OpBuilder &builder) {
37-
return builder.create<cir::ConstantOp>(
38-
getLoc(), slot.elemType, builder.getAttr<cir::UndefAttr>(slot.elemType));
37+
return builder.create<cir::ConstantOp>(getLoc(), slot.elemType,
38+
cir::UndefAttr::get(slot.elemType));
3939
}
4040

4141
void cir::AllocaOp::handleBlockArgument(const MemorySlot &slot,

0 commit comments

Comments
 (0)