@@ -446,7 +446,19 @@ class Verifier : public ASTWalker {
446
446
bool shouldVerify (Decl *S) { return true ; }
447
447
448
448
// Default cases for whether we should verify a checked subtree.
449
- bool shouldVerifyChecked (Expr *E) { return !E->getType ().isNull (); }
449
+ bool shouldVerifyChecked (Expr *E) {
450
+ if (!E->getType ()) {
451
+ // For @objc enums, we serialize the pre-type-checked integer
452
+ // literal raw values, and thus when they are deserialized
453
+ // they do not have a type on them.
454
+ if (!isa<IntegerLiteralExpr>(E)) {
455
+ Out << " expression has no type\n " ;
456
+ E->print (Out);
457
+ abort ();
458
+ }
459
+ }
460
+ return true ;
461
+ }
450
462
bool shouldVerifyChecked (Stmt *S) { return true ; }
451
463
bool shouldVerifyChecked (Pattern *S) { return S->hasType (); }
452
464
bool shouldVerifyChecked (Decl *S) { return true ; }
@@ -506,8 +518,9 @@ class Verifier : public ASTWalker {
506
518
// Some imported expressions don't have types, even in checked mode.
507
519
// TODO: eliminate all these
508
520
if (!E->getType ()) {
509
- // The raw value of an imported EnumElementDecl doesn't seem to have
510
- // a type for some reason.
521
+ // For @objc enums, we serialize the pre-type-checked integer
522
+ // literal raw values, and thus when they are deserialized
523
+ // they do not have a type on them.
511
524
if (!isa<IntegerLiteralExpr>(E)) {
512
525
Out << " expression has no type\n " ;
513
526
E->print (Out);
0 commit comments