[PATCH] D29362: Return Error instead of bool from mergeTypeStreams().

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 11:51:03 PST 2017


zturner added a comment.

Hmm, that's a bummer.  In that case I guess I like using the `Optional<>` better.  More comments inline.



================
Comment at: llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp:176
   TypeVisitorCallbackPipeline Pipeline;
+  LastError = Error::success();
 
----------------
ruiu wrote:
> No, because we overwrite it unconditionally here.
Before this, add `assert(!LastError.hasValue());`


================
Comment at: llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp:188
+
+  return std::move(LastError);
 }
----------------
Then this can change to 

```
Error Result = std::move(*LastError);
LastError.reset();
return std::move(Result);
```


https://reviews.llvm.org/D29362





More information about the llvm-commits mailing list