[NFC] Improve deserialization errors for wrong record kind

There are a bunch of places where we expect to find a record with a particular record ID/kind in the decls_block and have to bail out if we see something we don’t expect. Add an `InvalidRecordKindError` we can use in this situation to produce a useful error message and adopt it in various places.

This change also makes deserialization errors print the path to the invalid file.
This commit is contained in:
Becca Royal-Gordon
2022-09-12 13:35:59 -07:00
committed by GitHub
parent 6075af2652
commit d20e00e531
3 changed files with 62 additions and 22 deletions

View File

@@ -585,6 +585,8 @@ void ModuleFileSharedCore::outputDiagnosticInfo(llvm::raw_ostream &os) const {
<< "'";
if (Bits.IsAllowModuleWithCompilerErrorsEnabled)
os << " (built with -experimental-allow-module-with-compiler-errors)";
if (ModuleInputBuffer)
os << " at '" << ModuleInputBuffer->getBufferIdentifier() << "'";
}
ModuleFileSharedCore::~ModuleFileSharedCore() { }