Previously, mergeTypeStreams returns only true or false, so it was
impossible to know the reason if it failed. This patch changes the
function signature so that it returns an Error object.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h | ||
---|---|---|
16 ↗ | (On Diff #86545) | Should probably #include "llvm/Support/Error.h" here. |
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | ||
98–99 ↗ | (On Diff #86545) | If there is more than one error, this will trigger an exception because you will have not checked the previous value of the error. Instead of storing an Optional<Error> maybe try storing just an Error, and then saying LastError = llvm::join_errors(std::move(LastError), llvm::make_error<CodeViewError>(cv_error_code::corrupt_record)); |
180 ↗ | (On Diff #86545) | If you do the above, you can simply return LastError here. |
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | ||
---|---|---|
62 ↗ | (On Diff #86684) | Shouldn't we do this in the destructor instead? |
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | ||
---|---|---|
176 ↗ | (On Diff #86684) | No, because we overwrite it unconditionally here. |
Comment Actions
Hmm, that's a bummer. In that case I guess I like using the Optional<> better. More comments inline.
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | ||
---|---|---|
176 ↗ | (On Diff #86684) | Before this, add assert(!LastError.hasValue()); |
188 ↗ | (On Diff #86684) | Then this can change to Error Result = std::move(*LastError); LastError.reset(); return std::move(Result); |