[clang] 69242e9 - clang/Modules: Sink ASTReadResult in ReadControlBlock, NFC
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 19 16:12:23 PST 2019
Author: Duncan P. N. Exon Smith
Date: 2019-11-19T16:10:44-08:00
New Revision: 69242e986823e3fdd11a8e51f47f36bec714363c
URL: https://github.com/llvm/llvm-project/commit/69242e986823e3fdd11a8e51f47f36bec714363c
DIFF: https://github.com/llvm/llvm-project/commit/69242e986823e3fdd11a8e51f47f36bec714363c.diff
LOG: 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`.
Added:
Modified:
clang/lib/Serialization/ASTReader.cpp
Removed:
################################################################################
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 9111b60a7179..36c2952346a7 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -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;
More information about the cfe-commits
mailing list