[llvm] r293824 - Revert r293820: Return Error instead of bool from mergeTypeStreams().
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 1 14:28:44 PST 2017
Author: ruiu
Date: Wed Feb 1 16:28:43 2017
New Revision: 293824
URL: http://llvm.org/viewvc/llvm-project?rev=293824&view=rev
Log:
Revert r293820: Return Error instead of bool from mergeTypeStreams().
It broke buildbots.
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h?rev=293824&r1=293823&r2=293824&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h Wed Feb 1 16:28:43 2017
@@ -13,13 +13,12 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
-#include "llvm/Support/Error.h"
namespace llvm {
namespace codeview {
/// Merges one type stream into another. Returns true on success.
-Error mergeTypeStreams(TypeTableBuilder &DestStream, const CVTypeArray &Types);
+bool mergeTypeStreams(TypeTableBuilder &DestStream, const CVTypeArray &Types);
} // end namespace codeview
} // end namespace llvm
Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp?rev=293824&r1=293823&r2=293824&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp Wed Feb 1 16:28:43 2017
@@ -55,7 +55,9 @@ namespace {
class TypeStreamMerger : public TypeVisitorCallbacks {
public:
TypeStreamMerger(TypeTableBuilder &DestStream)
- : DestStream(DestStream), FieldListBuilder(DestStream) {}
+ : DestStream(DestStream), FieldListBuilder(DestStream) {
+ assert(!hadError());
+ }
/// TypeVisitorCallbacks overrides.
#define TYPE_RECORD(EnumName, EnumVal, Name) \
@@ -72,15 +74,12 @@ public:
Error visitTypeEnd(CVType &Record) override;
Error visitMemberEnd(CVMemberRecord &Record) override;
- Error mergeStream(const CVTypeArray &Types);
+ bool mergeStream(const CVTypeArray &Types);
private:
template <typename RecordType>
Error visitKnownRecordImpl(RecordType &Record) {
- if (!Record.remapTypeIndices(IndexMap))
- LastError = joinErrors(
- std::move(*LastError),
- llvm::make_error<CodeViewError>(cv_error_code::corrupt_record));
+ FoundBadTypeIndex |= !Record.remapTypeIndices(IndexMap);
IndexMap.push_back(DestStream.writeKnownType(Record));
return Error::success();
}
@@ -95,15 +94,14 @@ private:
template <typename RecordType>
Error visitKnownMemberRecordImpl(RecordType &Record) {
- if (!Record.remapTypeIndices(IndexMap))
- LastError = joinErrors(
- std::move(*LastError),
- llvm::make_error<CodeViewError>(cv_error_code::corrupt_record));
+ FoundBadTypeIndex |= !Record.remapTypeIndices(IndexMap);
FieldListBuilder.writeMemberType(Record);
return Error::success();
}
- Optional<Error> LastError;
+ bool hadError() { return FoundBadTypeIndex; }
+
+ bool FoundBadTypeIndex = false;
BumpPtrAllocator Allocator;
@@ -165,10 +163,9 @@ Error TypeStreamMerger::visitUnknownType
return llvm::make_error<CodeViewError>(cv_error_code::corrupt_record);
}
-Error TypeStreamMerger::mergeStream(const CVTypeArray &Types) {
+bool TypeStreamMerger::mergeStream(const CVTypeArray &Types) {
assert(IndexMap.empty());
TypeVisitorCallbackPipeline Pipeline;
- LastError = Error::success();
TypeDeserializer Deserializer;
Pipeline.addCallbackToPipeline(Deserializer);
@@ -176,16 +173,15 @@ Error TypeStreamMerger::mergeStream(cons
CVTypeVisitor Visitor(Pipeline);
- if (auto EC = Visitor.visitTypeStream(Types))
- return EC;
+ if (auto EC = Visitor.visitTypeStream(Types)) {
+ consumeError(std::move(EC));
+ return false;
+ }
IndexMap.clear();
-
- Error Ret = std::move(*LastError);
- LastError.reset();
- return Ret;
+ return !hadError();
}
-Error llvm::codeview::mergeTypeStreams(TypeTableBuilder &DestStream,
- const CVTypeArray &Types) {
+bool llvm::codeview::mergeTypeStreams(TypeTableBuilder &DestStream,
+ const CVTypeArray &Types) {
return TypeStreamMerger(DestStream).mergeStream(Types);
}
More information about the llvm-commits
mailing list