diff options
author | Lang Hames <lhames@gmail.com> | 2016-10-25 22:41:54 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2016-10-25 22:41:54 +0000 |
commit | 497fd941092436346435e0a5367341e434fbd1d4 (patch) | |
tree | 1944f5fe7f14aca0082730002470c26ea42ece1c /llvm/docs/ProgrammersManual.rst | |
parent | ca20d9eb95d68e9f5e3cb919879ba220d787d171 (diff) | |
download | bcm5719-llvm-497fd941092436346435e0a5367341e434fbd1d4.tar.gz bcm5719-llvm-497fd941092436346435e0a5367341e434fbd1d4.zip |
[docs] Use consistent style for "do more stuff" in Error docs examples.
llvm-svn: 285138
Diffstat (limited to 'llvm/docs/ProgrammersManual.rst')
-rw-r--r-- | llvm/docs/ProgrammersManual.rst | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst index c1081f199bb..954872e5917 100644 --- a/llvm/docs/ProgrammersManual.rst +++ b/llvm/docs/ProgrammersManual.rst @@ -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) |