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
Diff Detail
- Build Status
Buildable 3465 Build 3465: arc lint + arc unit
Event Timeline
llvm/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h | ||
---|---|---|
16 | Should probably #include "llvm/Support/Error.h" here. | |
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | ||
98–99 | 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 | If you do the above, you can simply return LastError here. |
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | ||
---|---|---|
60 | Shouldn't we do this in the destructor instead? |
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | ||
---|---|---|
169 | No, because we overwrite it unconditionally here. |
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 | ||
---|---|---|
169 | Before this, add assert(!LastError.hasValue()); | |
180 | Then this can change to Error Result = std::move(*LastError); LastError.reset(); return std::move(Result); |
Should probably #include "llvm/Support/Error.h" here.