@@ -40,24 +40,24 @@ struct detail::ClassTypeStorage : public TypeStorage {
4040 public:
4141 using KeyTy = StringRef;
4242
43- explicit ClassTypeStorage (const KeyTy & key) : name_(key) {}
43+ explicit ClassTypeStorage (const KeyTy& key) : name_(key) {}
4444
4545 auto getName () -> StringRef const { return name_; }
4646 auto getBody () const -> ArrayRef<Type> { return body_; }
4747
48- auto operator ==(const KeyTy & key) const -> bool { return name_ == key; };
48+ auto operator ==(const KeyTy& key) const -> bool { return name_ == key; };
4949
50- static auto hashKey (const KeyTy & key) -> llvm::hash_code {
50+ static auto hashKey (const KeyTy& key) -> llvm::hash_code {
5151 return llvm::hash_value (key);
5252 }
5353
54- static ClassTypeStorage * construct (TypeStorageAllocator & allocator,
55- const KeyTy & key) {
54+ static ClassTypeStorage* construct (TypeStorageAllocator& allocator,
55+ const KeyTy& key) {
5656 return new (allocator.allocate <ClassTypeStorage>())
5757 ClassTypeStorage (allocator.copyInto (key));
5858 }
5959
60- auto mutate (TypeStorageAllocator & allocator, ArrayRef<Type> body)
60+ auto mutate (TypeStorageAllocator& allocator, ArrayRef<Type> body)
6161 -> LogicalResult {
6262 if (isInitialized_) return success (body == getBody ());
6363
@@ -79,7 +79,7 @@ struct CxxGenerateAliases : public OpAsmDialectInterface {
7979 public:
8080 using OpAsmDialectInterface::OpAsmDialectInterface;
8181
82- auto getAlias (Type type, raw_ostream & os) const -> AliasResult override {
82+ auto getAlias (Type type, raw_ostream& os) const -> AliasResult override {
8383 if (auto intType = dyn_cast<IntegerType>(type)) {
8484 os << ' i' << intType.getWidth () << (intType.getIsSigned () ? ' s' : ' u' );
8585 return AliasResult::FinalAlias;
@@ -126,18 +126,18 @@ void CxxDialect::initialize() {
126126 addInterface<CxxGenerateAliases>();
127127}
128128
129- void FuncOp::print (OpAsmPrinter & p) {
129+ void FuncOp::print (OpAsmPrinter& p) {
130130 const auto isVariadic = getFunctionType ().getVariadic ();
131131 function_interface_impl::printFunctionOp (
132132 p, *this , isVariadic, getFunctionTypeAttrName (), getArgAttrsAttrName (),
133133 getResAttrsAttrName ());
134134}
135135
136- auto FuncOp::parse (OpAsmParser & parser, OperationState & result) -> ParseResult {
136+ auto FuncOp::parse (OpAsmParser& parser, OperationState& result) -> ParseResult {
137137 auto funcTypeBuilder =
138- [](Builder & builder, llvm::ArrayRef<Type> argTypes,
138+ [](Builder& builder, llvm::ArrayRef<Type> argTypes,
139139 ArrayRef<Type> results, function_interface_impl::VariadicFlag,
140- std::string &) { return builder.getFunctionType (argTypes, results); };
140+ std::string&) { return builder.getFunctionType (argTypes, results); };
141141
142142 return function_interface_impl::parseFunctionOp (
143143 parser, result, false , getFunctionTypeAttrName (result.name ),
@@ -163,17 +163,17 @@ auto StoreOp::verify() -> LogicalResult {
163163 return success ();
164164}
165165
166- void SwitchOp::build (OpBuilder & builder, OperationState & result, Value value,
167- Block * defaultDestination, ValueRange defaultOperands,
166+ void SwitchOp::build (OpBuilder& builder, OperationState& result, Value value,
167+ Block* defaultDestination, ValueRange defaultOperands,
168168 DenseIntElementsAttr caseValues,
169169 BlockRange caseDestinations,
170170 ArrayRef<ValueRange> caseOperands) {
171171 build (builder, result, value, defaultOperands, caseOperands, caseValues,
172172 defaultDestination, caseDestinations);
173173}
174174
175- void SwitchOp::build (OpBuilder & builder, OperationState & result, Value value,
176- Block * defaultDestination, ValueRange defaultOperands,
175+ void SwitchOp::build (OpBuilder& builder, OperationState& result, Value value,
176+ Block* defaultDestination, ValueRange defaultOperands,
177177 ArrayRef<std::int64_t > caseValues,
178178 BlockRange caseDestinations,
179179 ArrayRef<ValueRange> caseOperands) {
@@ -195,7 +195,8 @@ void SwitchOp::build(OpBuilder &builder, OperationState &result, Value value,
195195 caseValuesAttr = mlir::cast<DenseIntElementsAttr>(
196196 DenseIntElementsAttr::get (shapeType, caseValues)
197197 .mapValues (elementTy, [&](APInt v) {
198- return APInt (elementTy.getIntOrFloatBitWidth (), v.getZExtValue ());
198+ return APInt (elementTy.getIntOrFloatBitWidth (), v.getZExtValue (),
199+ false , true );
199200 }));
200201 }
201202
@@ -209,15 +210,15 @@ auto FunctionType::clone(TypeRange inputs, TypeRange results) const
209210 getVariadic ());
210211}
211212
212- auto ClassType::getNamed (MLIRContext * context, StringRef name) -> ClassType {
213+ auto ClassType::getNamed (MLIRContext* context, StringRef name) -> ClassType {
213214 return Base::get (context, name);
214215}
215216
216217auto ClassType::setBody (llvm::ArrayRef<Type> body) -> LogicalResult {
217218 Base::mutate (body);
218219}
219220
220- void ClassType::print (AsmPrinter & p) const {
221+ void ClassType::print (AsmPrinter& p) const {
221222 FailureOr<AsmPrinter::CyclicPrintReset> cyclicPrint;
222223
223224 p << " <" ;
@@ -242,7 +243,7 @@ void ClassType::print(AsmPrinter &p) const {
242243 p << ' >' ;
243244}
244245
245- auto ClassType::parse (AsmParser & parser) -> Type {
246+ auto ClassType::parse (AsmParser& parser) -> Type {
246247 // todo: implement parsing for ClassType
247248 return {};
248249}
0 commit comments