aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-10-21 15:57:15 -0700
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-10-22 12:40:10 -0700
commit2410fb4616b2c08bbaddd44e6c11da8285fbd1d3 (patch)
tree840f4d7df58e12c26f2801838995c9bbf3193f7b /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parentc4ba1108dd6065dd3cce5edafcebbb6fe4fb3a0e (diff)
downloadllvm-2410fb4616b2c08bbaddd44e6c11da8285fbd1d3.zip
llvm-2410fb4616b2c08bbaddd44e6c11da8285fbd1d3.tar.gz
llvm-2410fb4616b2c08bbaddd44e6c11da8285fbd1d3.tar.bz2
Support: Use Expected<T>::moveInto() in a few places
These are some usage examples for `Expected<T>::moveInto()`. Differential Revision: https://reviews.llvm.org/D112280
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 349d40e..3011459 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -179,10 +179,8 @@ static Expected<std::string> readIdentificationBlock(BitstreamCursor &Stream) {
while (true) {
BitstreamEntry Entry;
- if (Expected<BitstreamEntry> Res = Stream.advance())
- Entry = Res.get();
- else
- return Res.takeError();
+ if (Error E = Stream.advance().moveInto(Entry))
+ return std::move(E);
switch (Entry.Kind) {
default:
@@ -226,10 +224,8 @@ static Expected<std::string> readIdentificationCode(BitstreamCursor &Stream) {
return "";
BitstreamEntry Entry;
- if (Expected<BitstreamEntry> Res = Stream.advance())
- Entry = std::move(Res.get());
- else
- return Res.takeError();
+ if (Error E = Stream.advance().moveInto(Entry))
+ return std::move(E);
switch (Entry.Kind) {
case BitstreamEntry::EndBlock:
@@ -305,10 +301,8 @@ static Expected<bool> hasObjCCategory(BitstreamCursor &Stream) {
// need to understand them all.
while (true) {
BitstreamEntry Entry;
- if (Expected<BitstreamEntry> Res = Stream.advance())
- Entry = std::move(Res.get());
- else
- return Res.takeError();
+ if (Error E = Stream.advance().moveInto(Entry))
+ return std::move(E);
switch (Entry.Kind) {
case BitstreamEntry::Error: