Skip to content

Commit 5fb7b9d

Browse files
author
git apple-llvm automerger
committed
Merge commit '3ae43a580eea' from llvm.org/master into apple/master
2 parents 711cff0 + 3ae43a5 commit 5fb7b9d

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)