Skip to content

Commit f27d343

Browse files
author
git apple-llvm automerger
committed
Merge commit '5fb7b9d6d4b8' from apple/master into swift/master-next
2 parents 487cc76 + 5fb7b9d commit f27d343

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2129,15 +2129,19 @@ void OpOperandAdaptorEmitter::emitDef(const Operator &op, raw_ostream &os) {
21292129
// Emits the opcode enum and op classes.
21302130
static void emitOpClasses(const std::vector<Record *> &defs, raw_ostream &os,
21312131
bool emitDecl) {
2132-
IfDefScope scope("GET_OP_CLASSES", os);
21332132
// First emit forward declaration for each class, this allows them to refer
21342133
// to each others in traits for example.
21352134
if (emitDecl) {
2135+
os << "#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES)\n";
2136+
os << "#undef GET_OP_FWD_DEFINES\n";
21362137
for (auto *def : defs) {
21372138
Operator op(*def);
21382139
os << "class " << op.getCppClassName() << ";\n";
21392140
}
2141+
os << "#endif\n\n";
21402142
}
2143+
2144+
IfDefScope scope("GET_OP_CLASSES", os);
21412145
for (auto *def : defs) {
21422146
Operator op(*def);
21432147
if (emitDecl) {

0 commit comments

Comments
 (0)