clang/Modules: Sink ASTReadResult in ReadControlBlock, NFC

Simplify the code by avoiding some state that wasn't being used.  The
function-level `Result` was only assigned a value other than `Success`
in the handler for `OPTIONS_BLOCK_ID`, but in that case it also hits an
early return.  Remove it at the function-level to make it obvious that
the normal case always returns `Success`.
This commit is contained in:
Duncan P. N. Exon Smith 2019-11-19 14:44:22 -08:00
parent 85589f8077
commit 69242e9868
1 changed files with 5 additions and 5 deletions

View File

@ -2561,7 +2561,6 @@ ASTReader::ReadControlBlock(ModuleFile &F,
const ModuleFile *ImportedBy,
unsigned ClientLoadCapabilities) {
BitstreamCursor &Stream = F.Stream;
ASTReadResult Result = Success;
if (llvm::Error Err = Stream.EnterSubBlock(CONTROL_BLOCK_ID)) {
Error(std::move(Err));
@ -2652,7 +2651,7 @@ ASTReader::ReadControlBlock(ModuleFile &F,
}
}
return Result;
return Success;
}
case llvm::BitstreamEntry::SubBlock:
@ -2682,9 +2681,10 @@ ASTReader::ReadControlBlock(ModuleFile &F,
bool AllowCompatibleConfigurationMismatch =
F.Kind == MK_ExplicitModule || F.Kind == MK_PrebuiltModule;
Result = ReadOptionsBlock(Stream, ClientLoadCapabilities,
AllowCompatibleConfigurationMismatch,
*Listener, SuggestedPredefines);
ASTReadResult Result =
ReadOptionsBlock(Stream, ClientLoadCapabilities,
AllowCompatibleConfigurationMismatch, *Listener,
SuggestedPredefines);
if (Result == Failure) {
Error("malformed block record in AST file");
return Result;