mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-03 17:31:50 +00:00
[docs] Use consistent style for "do more stuff" in Error docs examples.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285138 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
41965a8963
commit
781a2b464b
@ -398,7 +398,7 @@ operator. If failure, the ``Error`` value can be extracted using the
|
||||
if (auto FileOrErr = openFormattedFile(Path)) {
|
||||
// On success, grab a reference to the file and continue.
|
||||
auto &File = *FileOrErr;
|
||||
// ...
|
||||
...
|
||||
} else
|
||||
// On error, extract the Error value and return it.
|
||||
return FileOrErr.takeError();
|
||||
@ -418,7 +418,7 @@ rewritten as:
|
||||
return Err;
|
||||
// On success, grab a reference to the file and continue.
|
||||
auto &File = *FileOrErr;
|
||||
// ...
|
||||
...
|
||||
}
|
||||
|
||||
This second form is often more readable for functions that involve multiple
|
||||
@ -695,7 +695,8 @@ type inspection method, ``isA``, and the ``consumeError`` function:
|
||||
return Err;
|
||||
}
|
||||
auto &Child = *ChildOrErr;
|
||||
// do work
|
||||
// Use Child
|
||||
...
|
||||
}
|
||||
return Error::success();
|
||||
}
|
||||
@ -719,7 +720,8 @@ completing the walk over the archive they could use the ``joinErrors`` utility:
|
||||
else
|
||||
return Err;
|
||||
auto &Child = *ChildOrErr;
|
||||
// do work
|
||||
// Use Child
|
||||
...
|
||||
}
|
||||
return DeferredErrs;
|
||||
}
|
||||
@ -751,7 +753,8 @@ class) the result is much cleaner iteration idiom:
|
||||
|
||||
Error Err;
|
||||
for (auto &Child : Ar->children(Err)) {
|
||||
// Use Child - we only enter the loop when it’s valid.
|
||||
// Use Child - we only enter the loop when it’s valid
|
||||
...
|
||||
}
|
||||
// Check Err after the loop to ensure it didn’t break due to an error.
|
||||
if (Err)
|
||||
|
Loading…
Reference in New Issue
Block a user