Skip to content

Commit a036033

Browse files
committed
[AST] Remove some redundant code for printing attributes
And make it less likely to happen again in the future.
1 parent 098a1c9 commit a036033

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/AST/Attr.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,6 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
498498
break;
499499
}
500500

501-
case DAK_StaticInitializeObjCMetadata:
502-
Printer.printAttrName("@_staticInitializeObjCMetadata");
503-
break;
504-
505-
case DAK_DowngradeExhaustivityCheck:
506-
Printer.printAttrName("@_downgrade_exhaustivity_check");
507-
break;
508-
509501
case DAK_ClangImporterSynthesizedType: {
510502
Printer.printAttrName("@_clangImporterSynthesizedType");
511503
auto *attr = cast<ClangImporterSynthesizedTypeAttr>(this);
@@ -517,8 +509,13 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
517509
case DAK_Count:
518510
llvm_unreachable("exceed declaration attribute kinds");
519511

512+
#define SIMPLE_DECL_ATTR(X, CLASS, ...) case DAK_##CLASS:
513+
#include "swift/AST/Attr.def"
514+
llvm_unreachable("handled above");
515+
520516
default:
521-
llvm_unreachable("handled before this switch");
517+
assert(DeclAttribute::isDeclModifier(getKind()) &&
518+
"handled above");
522519
}
523520

524521
return true;

0 commit comments

Comments
 (0)