Make the Error class constructor protected
This is forcing to use Error::success(), which is in a wide majority
of cases a lot more readable.
Differential Revision: https://reviews.llvm.org/D26481
llvm-svn: 286561
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 4684c18..f2021f79 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -458,7 +458,7 @@
return malformedError(Msg + NameOrErr.get());
}
- Error Err;
+ Error Err = Error::success();
Child Ret(Parent, NextLoc, &Err);
if (Err)
return std::move(Err);
@@ -508,7 +508,7 @@
}
Expected<std::unique_ptr<Archive>> Archive::create(MemoryBufferRef Source) {
- Error Err;
+ Error Err = Error::success();
std::unique_ptr<Archive> Ret(new Archive(Source, Err));
if (Err)
return std::move(Err);
@@ -830,7 +830,7 @@
}
const char *Loc = Parent->getData().begin() + Offset;
- Error Err;
+ Error Err = Error::success();
Child C(Parent, Loc, &Err);
if (Err)
return std::move(Err);