-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Deserializer: better error message if types of referenced functions don't match #71612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deserializer: better error message if types of referenced functions don't match #71612
Conversation
@swift-ci test |
fnName = decl->getNameStr(); | ||
} | ||
fn->getModule().getASTContext().Diags.diagnose(fn->getLocation().getSourceLoc(), diag::deserialize_function_type_mismatch, fnName, fnType.getASTType(), type.getASTType()); | ||
exit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there something we can do other than exit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find anything better. We need to abort here immediately to not run into subsequent asserts/crashes.
I'm open to suggestions :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe llvm::report_fatal_error()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That also let it look like a compiler crash
lib/Serialization/DeserializeSIL.cpp
Outdated
if (auto *decl = dyn_cast_or_null<AbstractFunctionDecl>(dc->getAsDecl())) | ||
fnName = decl->getNameStr(); | ||
} | ||
fn->getModule().getASTContext().Diags.diagnose(fn->getLocation().getSourceLoc(), diag::deserialize_function_type_mismatch, fnName, fnType.getASTType(), type.getASTType()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is too long
fnName = decl->getNameStr(); | ||
} | ||
fn->getModule().getASTContext().Diags.diagnose(fn->getLocation().getSourceLoc(), diag::deserialize_function_type_mismatch, fnName, fnType.getASTType(), type.getASTType()); | ||
exit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe llvm::report_fatal_error()?
…on't match So far this resulted in an assert (in best case). Now a readable error is printed.
f7b24bb
to
232a244
Compare
@swift-ci test |
So far this resulted in an assert (in best case). Now a readable error is printed.