Skip to content

Commit 3dc7ff2

Browse files
committed
stop printing if the enum is empty
1 parent 7ebcb7b commit 3dc7ff2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ class DeclAndTypePrinter::Implementation
396396
auto elementTagMapping =
397397
owningPrinter.interopContext.getIrABIDetails().getEnumTagMapping(ED);
398398

399+
if (elementTagMapping.empty()) {
400+
os << "\n";
401+
return;
402+
}
403+
399404
os << " enum class cases {\n";
400405
for (const auto &pair : elementTagMapping) {
401406
os << " ";
@@ -404,11 +409,6 @@ class DeclAndTypePrinter::Implementation
404409
}
405410
os << " };\n"; // enum class cases' closing bracket
406411

407-
if (elementTagMapping.empty()) {
408-
os << "\n";
409-
return;
410-
}
411-
412412
// Printing operator cases()
413413
os << " inline operator cases() const {\n";
414414
os << " switch (_getEnumTag()) {\n";

0 commit comments

Comments
 (0)