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`.
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 9111b60..36c2952 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -2561,7 +2561,6 @@
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 @@
}
}
- return Result;
+ return Success;
}
case llvm::BitstreamEntry::SubBlock:
@@ -2682,9 +2681,10 @@
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;