mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[Support] Make error banner optional in logAllUnhandledErrors
In a lot of places an empty string was passed as the ErrorBanner to logAllUnhandledErrors. This patch makes that argument optional to simplify the call sites. llvm-svn: 346604
This commit is contained in:
parent
60cabf0534
commit
681a56eed2
@ -953,10 +953,14 @@ Expected<T> handleExpected(Expected<T> ValOrErr, RecoveryFtor &&RecoveryPath,
|
||||
/// will be printed before the first one is logged. A newline will be printed
|
||||
/// after each error.
|
||||
///
|
||||
/// This function is compatible with the helpers from Support/WithColor.h. You
|
||||
/// can pass any of them as the OS. Please consider using them instead of
|
||||
/// including 'error: ' in the ErrorBanner.
|
||||
///
|
||||
/// This is useful in the base level of your program to allow clean termination
|
||||
/// (allowing clean deallocation of resources, etc.), while reporting error
|
||||
/// information to the user.
|
||||
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner);
|
||||
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner = {});
|
||||
|
||||
/// Write all error messages (if any) in E to a string. The newline character
|
||||
/// is used to separate error messages.
|
||||
|
@ -216,7 +216,7 @@ void MCJIT::generateCodeForModule(Module *M) {
|
||||
if (!LoadedObject) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(LoadedObject.takeError(), OS, "");
|
||||
logAllUnhandledErrors(LoadedObject.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ RuntimeDyldCOFF::loadObject(const object::ObjectFile &O) {
|
||||
} else {
|
||||
HasError = true;
|
||||
raw_string_ostream ErrStream(ErrorStr);
|
||||
logAllUnhandledErrors(ObjSectionToIDOrErr.takeError(), ErrStream, "");
|
||||
logAllUnhandledErrors(ObjSectionToIDOrErr.takeError(), ErrStream);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ RuntimeDyldELF::loadObject(const object::ObjectFile &O) {
|
||||
else {
|
||||
HasError = true;
|
||||
raw_string_ostream ErrStream(ErrorStr);
|
||||
logAllUnhandledErrors(ObjSectionToIDOrErr.takeError(), ErrStream, "");
|
||||
logAllUnhandledErrors(ObjSectionToIDOrErr.takeError(), ErrStream);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -1130,7 +1130,7 @@ RuntimeDyldELF::processRelocationRef(
|
||||
if (!SymTypeOrErr) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(SymTypeOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(SymTypeOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -1151,7 +1151,7 @@ RuntimeDyldELF::processRelocationRef(
|
||||
if (!SectionOrErr) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(SectionOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(SectionOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ RuntimeDyldMachO::loadObject(const object::ObjectFile &O) {
|
||||
else {
|
||||
HasError = true;
|
||||
raw_string_ostream ErrStream(ErrorStr);
|
||||
logAllUnhandledErrors(ObjSectionToIDOrErr.takeError(), ErrStream, "");
|
||||
logAllUnhandledErrors(ObjSectionToIDOrErr.takeError(), ErrStream);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ static bool isThumbFunc(symbol_iterator Symbol, const ObjectFile &Obj,
|
||||
if (!SymTypeOrErr) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(SymTypeOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(SymTypeOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ bool LTOModule::isBitcodeFile(StringRef Path) {
|
||||
bool LTOModule::isThinLTO() {
|
||||
Expected<BitcodeLTOInfo> Result = getBitcodeLTOInfo(MBRef);
|
||||
if (!Result) {
|
||||
logAllUnhandledErrors(Result.takeError(), errs(), "");
|
||||
logAllUnhandledErrors(Result.takeError(), errs());
|
||||
return false;
|
||||
}
|
||||
return Result->IsThinLTO;
|
||||
|
@ -105,7 +105,7 @@ void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
|
||||
if (!SecOrErr) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(SecOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(SecOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -187,7 +187,7 @@ const char *LLVMGetSymbolName(LLVMSymbolIteratorRef SI) {
|
||||
if (!Ret) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(Ret.takeError(), OS, "");
|
||||
logAllUnhandledErrors(Ret.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -199,7 +199,7 @@ uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI) {
|
||||
if (!Ret) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(Ret.takeError(), OS, "");
|
||||
logAllUnhandledErrors(Ret.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ void report_fatal_error(Error Err, bool GenCrashDiag) {
|
||||
std::string ErrMsg;
|
||||
{
|
||||
raw_string_ostream ErrStream(ErrMsg);
|
||||
logAllUnhandledErrors(std::move(Err), ErrStream, "");
|
||||
logAllUnhandledErrors(std::move(Err), ErrStream);
|
||||
}
|
||||
report_fatal_error(ErrMsg);
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ int main(int argc, char **argv, char * const *envp) {
|
||||
if (!ArOrErr) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(ArOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(ArOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
errs() << Buf;
|
||||
exit(1);
|
||||
|
@ -33,7 +33,7 @@ int convertForTestingMain(int argc, const char *argv[]) {
|
||||
if (!ObjErr) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(ObjErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(ObjErr.takeError(), OS);
|
||||
OS.flush();
|
||||
errs() << "error: " << Buf;
|
||||
return 1;
|
||||
|
@ -52,7 +52,8 @@ static void error(std::error_code EC) {
|
||||
static void error(Error Err) {
|
||||
if (!Err)
|
||||
return;
|
||||
logAllUnhandledErrors(std::move(Err), WithColor::error(outs(), ""), "reading file: ");
|
||||
logAllUnhandledErrors(std::move(Err), WithColor::error(outs()),
|
||||
"reading file: ");
|
||||
outs().flush();
|
||||
exit(1);
|
||||
}
|
||||
@ -497,7 +498,7 @@ static void dumpArchive(const Archive *Arc) {
|
||||
if (auto E = isNotObjectErrorInvalidFileType(ChildOrErr.takeError())) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
logAllUnhandledErrors(std::move(E), OS);
|
||||
OS.flush();
|
||||
reportError(Arc->getFileName(), Buf);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ static bool error(std::error_code EC, Twine Path = Twine()) {
|
||||
|
||||
// This version of error() prints the archive name and member name, for example:
|
||||
// "libx.a(foo.o)" after the ToolName before the error message. It sets
|
||||
// HadError but returns allowing the code to move on to other archive members.
|
||||
// HadError but returns allowing the code to move on to other archive members.
|
||||
static void error(llvm::Error E, StringRef FileName, const Archive::Child &C,
|
||||
StringRef ArchitectureName = StringRef()) {
|
||||
HadError = true;
|
||||
@ -230,7 +230,7 @@ static void error(llvm::Error E, StringRef FileName, const Archive::Child &C,
|
||||
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
logAllUnhandledErrors(std::move(E), OS);
|
||||
OS.flush();
|
||||
errs() << " " << Buf << "\n";
|
||||
}
|
||||
@ -238,7 +238,7 @@ static void error(llvm::Error E, StringRef FileName, const Archive::Child &C,
|
||||
// This version of error() prints the file name and which architecture slice it
|
||||
// is from, for example: "foo.o (for architecture i386)" after the ToolName
|
||||
// before the error message. It sets HadError but returns allowing the code to
|
||||
// move on to other architecture slices.
|
||||
// move on to other architecture slices.
|
||||
static void error(llvm::Error E, StringRef FileName,
|
||||
StringRef ArchitectureName = StringRef()) {
|
||||
HadError = true;
|
||||
@ -249,7 +249,7 @@ static void error(llvm::Error E, StringRef FileName,
|
||||
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
logAllUnhandledErrors(std::move(E), OS);
|
||||
OS.flush();
|
||||
errs() << " " << Buf << "\n";
|
||||
}
|
||||
@ -1029,8 +1029,7 @@ static char getSymbolNMTypeChar(MachOObjectFile &Obj, basic_symbol_iterator I) {
|
||||
StringRef SectionName;
|
||||
Obj.getSectionName(Ref, SectionName);
|
||||
StringRef SegmentName = Obj.getSectionFinalSegmentName(Ref);
|
||||
if (Obj.is64Bit() &&
|
||||
Obj.getHeader64().filetype == MachO::MH_KEXT_BUNDLE &&
|
||||
if (Obj.is64Bit() && Obj.getHeader64().filetype == MachO::MH_KEXT_BUNDLE &&
|
||||
SegmentName == "__TEXT_EXEC" && SectionName == "__text")
|
||||
return 't';
|
||||
if (SegmentName == "__TEXT" && SectionName == "__text")
|
||||
@ -1606,7 +1605,7 @@ dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
|
||||
uint64_t lc_main_offset = UINT64_MAX;
|
||||
for (const auto &Command : MachO->load_commands()) {
|
||||
if (Command.C.cmd == MachO::LC_FUNCTION_STARTS) {
|
||||
// We found a function starts segment, parse the addresses for
|
||||
// We found a function starts segment, parse the addresses for
|
||||
// consumption.
|
||||
MachO::linkedit_data_command LLC =
|
||||
MachO->getLinkeditDataLoadCommand(Command);
|
||||
|
@ -66,7 +66,7 @@ LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, Error E) {
|
||||
assert(E);
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
logAllUnhandledErrors(std::move(E), OS);
|
||||
OS.flush();
|
||||
WithColor::error(errs(), ToolName) << "'" << File << "': " << Buf;
|
||||
exit(1);
|
||||
|
@ -31,7 +31,7 @@ template <class T> T unwrapOrError(Expected<T> EO) {
|
||||
return *EO;
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(EO.takeError(), OS, "");
|
||||
logAllUnhandledErrors(EO.takeError(), OS);
|
||||
OS.flush();
|
||||
error(Buf);
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ LLVM_ATTRIBUTE_NORETURN void llvm::report_error(StringRef File,
|
||||
assert(E);
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
logAllUnhandledErrors(std::move(E), OS);
|
||||
OS.flush();
|
||||
errs() << ToolName << ": '" << File << "': " << Buf;
|
||||
exit(1);
|
||||
@ -392,7 +392,7 @@ LLVM_ATTRIBUTE_NORETURN void llvm::report_error(StringRef ArchiveName,
|
||||
errs() << " (for architecture " << ArchitectureName << ")";
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
logAllUnhandledErrors(std::move(E), OS);
|
||||
OS.flush();
|
||||
errs() << ": " << Buf;
|
||||
exit(1);
|
||||
|
@ -903,7 +903,7 @@ bool Decoder::dumpXDataRecord(const COFFObjectFile &COFF,
|
||||
if (!Name) {
|
||||
std::string Buf;
|
||||
llvm::raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(Name.takeError(), OS, "");
|
||||
logAllUnhandledErrors(Name.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -942,7 +942,7 @@ bool Decoder::dumpUnpackedEntry(const COFFObjectFile &COFF,
|
||||
if (!FunctionNameOrErr) {
|
||||
std::string Buf;
|
||||
llvm::raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(FunctionNameOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(FunctionNameOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -951,7 +951,7 @@ bool Decoder::dumpUnpackedEntry(const COFFObjectFile &COFF,
|
||||
if (!FunctionAddressOrErr) {
|
||||
std::string Buf;
|
||||
llvm::raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(FunctionAddressOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(FunctionAddressOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -967,7 +967,7 @@ bool Decoder::dumpUnpackedEntry(const COFFObjectFile &COFF,
|
||||
if (!Name) {
|
||||
std::string Buf;
|
||||
llvm::raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(Name.takeError(), OS, "");
|
||||
logAllUnhandledErrors(Name.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -976,7 +976,7 @@ bool Decoder::dumpUnpackedEntry(const COFFObjectFile &COFF,
|
||||
if (!AddressOrErr) {
|
||||
std::string Buf;
|
||||
llvm::raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(AddressOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(AddressOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -1025,7 +1025,7 @@ bool Decoder::dumpPackedEntry(const object::COFFObjectFile &COFF,
|
||||
if (!FunctionNameOrErr) {
|
||||
std::string Buf;
|
||||
llvm::raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(FunctionNameOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(FunctionNameOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
@ -1034,7 +1034,7 @@ bool Decoder::dumpPackedEntry(const object::COFFObjectFile &COFF,
|
||||
if (!FunctionAddressOrErr) {
|
||||
std::string Buf;
|
||||
llvm::raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(FunctionAddressOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(FunctionAddressOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace llvm {
|
||||
return *EO;
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(EO.takeError(), OS, "");
|
||||
logAllUnhandledErrors(EO.takeError(), OS);
|
||||
OS.flush();
|
||||
reportError(Buf);
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ static int printLineInfoForInput(bool LoadObjects, bool UseDebugObj) {
|
||||
if (!MaybeObj) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(MaybeObj.takeError(), OS, "");
|
||||
logAllUnhandledErrors(MaybeObj.takeError(), OS);
|
||||
OS.flush();
|
||||
ErrorAndExit("unable to create object file: '" + Buf + "'");
|
||||
}
|
||||
@ -438,7 +438,7 @@ static int executeInput() {
|
||||
if (!MaybeObj) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(MaybeObj.takeError(), OS, "");
|
||||
logAllUnhandledErrors(MaybeObj.takeError(), OS);
|
||||
OS.flush();
|
||||
ErrorAndExit("unable to create object file: '" + Buf + "'");
|
||||
}
|
||||
@ -710,7 +710,7 @@ static int linkAndVerify() {
|
||||
if (!MaybeObj) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(MaybeObj.takeError(), OS, "");
|
||||
logAllUnhandledErrors(MaybeObj.takeError(), OS);
|
||||
OS.flush();
|
||||
ErrorAndExit("unable to create object file: '" + Buf + "'");
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ static void error(llvm::Error E, StringRef FileName, const Archive::Child &C,
|
||||
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
logAllUnhandledErrors(std::move(E), OS);
|
||||
OS.flush();
|
||||
errs() << " " << Buf << "\n";
|
||||
}
|
||||
@ -158,7 +158,7 @@ static void error(llvm::Error E, StringRef FileName,
|
||||
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(std::move(E), OS, "");
|
||||
logAllUnhandledErrors(std::move(E), OS);
|
||||
OS.flush();
|
||||
errs() << " " << Buf << "\n";
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ static CommandRegistration Unused(&Stack, []() -> Error {
|
||||
Twine("Failed loading input file '") + Filename + "'",
|
||||
std::make_error_code(std::errc::invalid_argument)),
|
||||
TraceOrErr.takeError());
|
||||
logAllUnhandledErrors(TraceOrErr.takeError(), errs(), "");
|
||||
logAllUnhandledErrors(TraceOrErr.takeError(), errs());
|
||||
continue;
|
||||
}
|
||||
auto &T = *TraceOrErr;
|
||||
|
@ -188,7 +188,7 @@ void COFFDumper::dumpSections(unsigned NumSections) {
|
||||
if (!SymbolNameOrErr) {
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(SymbolNameOrErr.takeError(), OS, "");
|
||||
logAllUnhandledErrors(SymbolNameOrErr.takeError(), OS);
|
||||
OS.flush();
|
||||
report_fatal_error(Buf);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static void reportError(StringRef Input, Error Err) {
|
||||
Input = "<stdin>";
|
||||
std::string ErrMsg;
|
||||
raw_string_ostream OS(ErrMsg);
|
||||
logAllUnhandledErrors(std::move(Err), OS, "");
|
||||
logAllUnhandledErrors(std::move(Err), OS);
|
||||
OS.flush();
|
||||
errs() << "Error reading file: " << Input << ": " << ErrMsg;
|
||||
errs().flush();
|
||||
|
@ -112,10 +112,9 @@ TEST(RemoteObjectLayer, AddObject) {
|
||||
|
||||
auto Channels = createPairedQueueChannels();
|
||||
|
||||
auto ReportError =
|
||||
[](Error Err) {
|
||||
logAllUnhandledErrors(std::move(Err), llvm::errs(), "");
|
||||
};
|
||||
auto ReportError = [](Error Err) {
|
||||
logAllUnhandledErrors(std::move(Err), llvm::errs());
|
||||
};
|
||||
|
||||
// Copy the bytes out of the test object: the copy will be used to verify
|
||||
// that the original is correctly transmitted over RPC to the mock layer.
|
||||
@ -225,10 +224,9 @@ TEST(RemoteObjectLayer, RemoveObject) {
|
||||
|
||||
auto Channels = createPairedQueueChannels();
|
||||
|
||||
auto ReportError =
|
||||
[](Error Err) {
|
||||
logAllUnhandledErrors(std::move(Err), llvm::errs(), "");
|
||||
};
|
||||
auto ReportError = [](Error Err) {
|
||||
logAllUnhandledErrors(std::move(Err), llvm::errs());
|
||||
};
|
||||
|
||||
RPCEndpoint ClientEP(*Channels.first, true);
|
||||
RemoteObjectClientLayer<RPCEndpoint> Client(ClientEP, ReportError);
|
||||
@ -489,10 +487,9 @@ TEST(RemoteObjectLayer, EmitAndFinalize) {
|
||||
|
||||
auto Channels = createPairedQueueChannels();
|
||||
|
||||
auto ReportError =
|
||||
[](Error Err) {
|
||||
logAllUnhandledErrors(std::move(Err), llvm::errs(), "");
|
||||
};
|
||||
auto ReportError = [](Error Err) {
|
||||
logAllUnhandledErrors(std::move(Err), llvm::errs());
|
||||
};
|
||||
|
||||
RPCEndpoint ClientEP(*Channels.first, true);
|
||||
RemoteObjectClientLayer<RPCEndpoint> Client(ClientEP, ReportError);
|
||||
|
@ -434,9 +434,8 @@ TEST(Error, CatchErrorFromHandler) {
|
||||
TEST(Error, StringError) {
|
||||
std::string Msg;
|
||||
raw_string_ostream S(Msg);
|
||||
logAllUnhandledErrors(make_error<StringError>("foo" + Twine(42),
|
||||
inconvertibleErrorCode()),
|
||||
S, "");
|
||||
logAllUnhandledErrors(
|
||||
make_error<StringError>("foo" + Twine(42), inconvertibleErrorCode()), S);
|
||||
EXPECT_EQ(S.str(), "foo42\n") << "Unexpected StringError log result";
|
||||
|
||||
auto EC =
|
||||
@ -451,13 +450,13 @@ TEST(Error, createStringError) {
|
||||
std::string Msg;
|
||||
raw_string_ostream S(Msg);
|
||||
logAllUnhandledErrors(createStringError(EC, "foo%s%d0x%" PRIx8, Bar, 1, 0xff),
|
||||
S, "");
|
||||
S);
|
||||
EXPECT_EQ(S.str(), "foobar10xff\n")
|
||||
<< "Unexpected createStringError() log result";
|
||||
|
||||
S.flush();
|
||||
Msg.clear();
|
||||
logAllUnhandledErrors(createStringError(EC, Bar), S, "");
|
||||
logAllUnhandledErrors(createStringError(EC, Bar), S);
|
||||
EXPECT_EQ(S.str(), "bar\n")
|
||||
<< "Unexpected createStringError() (overloaded) log result";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user