[docs] Clarify Error example in Programmer's Manual.
authorLang Hames <lhames@gmail.com>
Thu, 24 Mar 2016 18:05:21 +0000 (18:05 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 24 Mar 2016 18:05:21 +0000 (18:05 +0000)
llvm-svn: 264314

llvm/docs/ProgrammersManual.rst

index 88a8f88..3779225 100644 (file)
@@ -361,11 +361,13 @@ success, enabling the following idiom:
 
 .. code-block:: c++
 
-  if (auto Err = mayFail())
-    return Err;
-
-  // Success! We can proceed.
+  Error mayFail();
 
+  Error foo() {
+    if (auto Err = mayFail())
+      return Err;
+    // Success! We can proceed.
+    ...
 
 For functions that can fail but need to return a value the ``Expected<T>``
 utility can be used. Values of this type can be constructed with either a