forked from OSchip/llvm-project
clang/Modules: Add missing diagnostics for malformed AST files
These were found via an audit. In the case of `ParseLineTable` this is actually dead code, since parsing the line table always succeeds, but it's prudent to be defensive since it's possible an assertion there could be converted to a `true` return in the future.
This commit is contained in:
parent
0b8dfb5762
commit
8e2c192e2a
|
@ -3408,8 +3408,10 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
|
|||
break;
|
||||
|
||||
case SOURCE_MANAGER_LINE_TABLE:
|
||||
if (ParseLineTable(F, Record))
|
||||
if (ParseLineTable(F, Record)) {
|
||||
Error("malformed SOURCE_MANAGER_LINE_TABLE in AST file");
|
||||
return Failure;
|
||||
}
|
||||
break;
|
||||
|
||||
case SOURCE_LOCATION_PRELOADS: {
|
||||
|
@ -4771,8 +4773,10 @@ ASTReader::ASTReadResult ASTReader::ReadExtensionBlock(ModuleFile &F) {
|
|||
switch (MaybeRecCode.get()) {
|
||||
case EXTENSION_METADATA: {
|
||||
ModuleFileExtensionMetadata Metadata;
|
||||
if (parseModuleFileExtensionMetadata(Record, Blob, Metadata))
|
||||
if (parseModuleFileExtensionMetadata(Record, Blob, Metadata)) {
|
||||
Error("malformed EXTENSION_METADATA in AST file");
|
||||
return Failure;
|
||||
}
|
||||
|
||||
// Find a module file extension with this block name.
|
||||
auto Known = ModuleFileExtensions.find(Metadata.BlockName);
|
||||
|
|
Loading…
Reference in New Issue