summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2019-11-19 14:44:22 -0800
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2019-11-19 16:10:44 -0800
commit69242e986823e3fdd11a8e51f47f36bec714363c (patch)
tree1df1a71d7fa1aaa7f5eead71b645354389264392 /clang/lib/Serialization
parent85589f8077a229a6fbc7c245ae28bec06b88c5fb (diff)
downloadbcm5719-llvm-69242e986823e3fdd11a8e51f47f36bec714363c.tar.gz
bcm5719-llvm-69242e986823e3fdd11a8e51f47f36bec714363c.zip
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`.
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 9111b60a717..36c2952346a 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;
OpenPOWER on IntegriCloud