[Bitcode] Handle invalid data layout gracefully

This commit is contained in:
Nikita Popov committed 2022-02-07 12:28:15 +01:00
1 parent a8d48fe0fe
commit fdf8cb978f
2 files changed
+6 -3

No files matched your search

+4 -1
View File
@@ -3800,7 +3800,10 @@ Error BitcodeReader::parseModule(uint64_t ResumeBit,
std::string S;
if (convertToString(Record, 0, S))
return error("Invalid record");
TheModule->setDataLayout(S);
Expected<DataLayout> MaybeDL = DataLayout::parse(S);
if (!MaybeDL)
return MaybeDL.takeError();
TheModule->setDataLayout(MaybeDL.get());
break;
}
case bitc::MODULE_CODE_ASM: { // ASM: [strchr x N]