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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user