[NFC] Fix error handling documentation
authorMiloš Stojanović <Milos.Stojanovic@rt-rk.com>
Thu, 6 Feb 2020 09:19:42 +0000 (10:19 +0100)
committerMiloš Stojanović <Milos.Stojanovic@rt-rk.com>
Thu, 6 Feb 2020 09:20:00 +0000 (10:20 +0100)
The default Error constructor can't be used since rL286561.

Differential Revision: https://reviews.llvm.org/D74069

llvm/docs/ProgrammersManual.rst
llvm/include/llvm/Object/MachO.h

index e4fb861..98002f6 100644 (file)
@@ -847,7 +847,7 @@ this, use the named constructor idiom and return an ``Expected<T>``:
   public:
 
     static Expected<Foo> Create(Resource R1, Resource R2) {
-      Error Err;
+      Error Err = Error::success();
       Foo F(R1, R2, Err);
       if (Err)
         return std::move(Err);
@@ -946,7 +946,7 @@ following natural iteration idiom for fallible containers like Archive:
 
 .. code-block:: c++
 
-  Error Err;
+  Error Err = Error::success();
   for (auto &Child : Ar->children(Err)) {
     // Use Child - only enter the loop when it's valid
 
index 8f6e2ff..380e390 100644 (file)
@@ -65,7 +65,7 @@ using dice_iterator = content_iterator<DiceRef>;
 /// ExportEntry encapsulates the current-state-of-the-walk used when doing a
 /// non-recursive walk of the trie data structure.  This allows you to iterate
 /// across all exported symbols using:
-///      Error Err;
+///      Error Err = Error::success();
 ///      for (const llvm::object::ExportEntry &AnExport : Obj->exports(&Err)) {
 ///      }
 ///      if (Err) { report error ...
@@ -160,7 +160,7 @@ private:
 /// MachORebaseEntry encapsulates the current state in the decompression of
 /// rebasing opcodes. This allows you to iterate through the compressed table of
 /// rebasing using:
-///    Error Err;
+///    Error Err = Error::success();
 ///    for (const llvm::object::MachORebaseEntry &Entry : Obj->rebaseTable(&Err)) {
 ///    }
 ///    if (Err) { report error ...
@@ -204,7 +204,7 @@ using rebase_iterator = content_iterator<MachORebaseEntry>;
 /// MachOBindEntry encapsulates the current state in the decompression of
 /// binding opcodes. This allows you to iterate through the compressed table of
 /// bindings using:
-///    Error Err;
+///    Error Err = Error::success();
 ///    for (const llvm::object::MachOBindEntry &Entry : Obj->bindTable(&Err)) {
 ///    }
 ///    if (Err) { report error ...