summaryrefslogtreecommitdiffstats
path: root/llvm/docs/ProgrammersManual.rst
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-10-25 22:35:55 +0000
committerLang Hames <lhames@gmail.com>2016-10-25 22:35:55 +0000
commit4f8a9604d09e6be4403ea670ba07bbc92fd7c854 (patch)
treea65cdcf3536db02d74febd9ec97f53fb8e657e94 /llvm/docs/ProgrammersManual.rst
parent117976818e1561b52f61800db2120e518753a3d6 (diff)
downloadbcm5719-llvm-4f8a9604d09e6be4403ea670ba07bbc92fd7c854.tar.gz
bcm5719-llvm-4f8a9604d09e6be4403ea670ba07bbc92fd7c854.zip
[docs] Fix a few more Error docs formatting issues.
Thanks to Pete Cooper for the review. llvm-svn: 285136
Diffstat (limited to 'llvm/docs/ProgrammersManual.rst')
-rw-r--r--llvm/docs/ProgrammersManual.rst11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst
index 2f2281c6fcc..b5386d0b5b6 100644
--- a/llvm/docs/ProgrammersManual.rst
+++ b/llvm/docs/ProgrammersManual.rst
@@ -586,7 +586,7 @@ code (especially command line tools) this can be a reasonable approach. Calling
``exit`` upon encountering an error dramatically simplifies control flow as the
error no longer needs to be propagated up the stack. This allows code to be
written in straight-line style, as long as each fallible call is wrapped in a
-check and call to exit. The ``ExitOnError``` class supports this pattern by
+check and call to exit. The ``ExitOnError`` class supports this pattern by
providing call operators that inspect ``Error`` values, stripping the error away
in the success case and logging to ``stderr`` then exiting in the failure case.
@@ -642,7 +642,7 @@ this, use the named constructor idiom and return an ``Expected<T>``:
class Foo {
public:
-
 static Expected<Foo> Create(Resource R1, Resource R2) {
+ static Expected<Foo> Create(Resource R1, Resource R2) {
Error Err;
Foo F(R1, R2, Err);
if (Err)
@@ -678,7 +678,7 @@ Propagating and consuming errors based on types
In some contexts, certain types of error are known to be benign. For example,
when walking an archive, some clients may be happy to skip over badly formatted
object files rather than terminating the walk immediately. Skipping badly
-formatted objects could be achieved using an elaborate handler method, But the
+formatted objects could be achieved using an elaborate handler method, but the
Error.h header provides two utilities that make this idiom much cleaner: the
type inspection method, ``isA``, and the ``consumeError`` function:
@@ -687,12 +687,13 @@ type inspection method, ``isA``, and the ``consumeError`` function:
Error walkArchive(Archive A) {
for (unsigned I = 0; I != A.numMembers(); ++I) {
auto ChildOrErr = A.getMember(I);
- if (auto Err = ChildOrErr.takeError())
+ if (auto Err = ChildOrErr.takeError()) {
if (Err.isA<BadFileFormat>())
consumeError(std::move(Err))
else
return Err;
- auto &Child = *ChildOrErr;
+ }
+ auto &Child = *ChildOrErr;
// do work
}
return Error::success();
OpenPOWER on IntegriCloud