Skip to content

Commit 30f479f

Browse files
authored
[CIR] Use default attribute printer/parser (NFC) (#170366)
1 parent 042a38f commit 30f479f

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ def CIR_Dialect : Dialect {
2424

2525
let cppNamespace = "::cir";
2626

27-
let useDefaultAttributePrinterParser = 0;
28-
let useDefaultTypePrinterParser = 0;
27+
let useDefaultAttributePrinterParser = 1;
2928

3029
// Enable constant materialization for the CIR dialect. This generates a
3130
// declaration for the cir::CIRDialect::materializeConstant function. This
@@ -52,12 +51,6 @@ def CIR_Dialect : Dialect {
5251
mlir::Type parseType(mlir::DialectAsmParser &parser) const override;
5352
void printType(mlir::Type type,
5453
mlir::DialectAsmPrinter &printer) const override;
55-
56-
mlir::Attribute parseAttribute(mlir::DialectAsmParser &parser,
57-
mlir::Type type) const override;
58-
59-
void printAttribute(mlir::Attribute attr,
60-
mlir::DialectAsmPrinter &os) const override;
6154
}];
6255
}
6356

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,6 @@ using namespace cir;
6868
// General CIR parsing / printing
6969
//===----------------------------------------------------------------------===//
7070

71-
Attribute CIRDialect::parseAttribute(DialectAsmParser &parser,
72-
Type type) const {
73-
llvm::SMLoc typeLoc = parser.getCurrentLocation();
74-
llvm::StringRef mnemonic;
75-
Attribute genAttr;
76-
OptionalParseResult parseResult =
77-
generatedAttributeParser(parser, &mnemonic, type, genAttr);
78-
if (parseResult.has_value())
79-
return genAttr;
80-
parser.emitError(typeLoc, "unknown attribute in CIR dialect");
81-
return Attribute();
82-
}
83-
84-
void CIRDialect::printAttribute(Attribute attr, DialectAsmPrinter &os) const {
85-
if (failed(generatedAttributePrinter(attr, os)))
86-
llvm_unreachable("unexpected CIR type kind");
87-
}
88-
8971
static void printRecordMembers(mlir::AsmPrinter &printer,
9072
mlir::ArrayAttr members) {
9173
printer << '{';

0 commit comments

Comments
 (0)