From 9b84ad14f40cfec638c339b35aeb5f20ac41f35a Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Fri, 15 Dec 2006 19:49:23 +0000 Subject: Fix long standing issue with propagating error message back to caller. This has been a problem since exceptions were removed from the BytecodeReader. Error messages are now captured from ModuleProvider::releaseModule as well as after a longjmp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32608 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bytecode/Reader/Reader.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/Bytecode/Reader/Reader.cpp') diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index e2ab8c10e6..1c747af948 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -1758,8 +1758,13 @@ void BytecodeReader::ParseFunctionLazily() { /// @see ParseBytecode bool BytecodeReader::ParseFunction(Function* Func, std::string* ErrMsg) { - if (setjmp(context)) + if (setjmp(context)) { + // Set caller's error message, if requested + if (ErrMsg) + *ErrMsg = ErrorMsg; + // Indicate an error occurred return true; + } // Find {start, end} pointers and slot in the map. If not there, we're done. LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.find(Func); @@ -1788,8 +1793,13 @@ bool BytecodeReader::ParseFunction(Function* Func, std::string* ErrMsg) { /// to materialize the functions. /// @see ParseBytecode bool BytecodeReader::ParseAllFunctionBodies(std::string* ErrMsg) { - if (setjmp(context)) + if (setjmp(context)) { + // Set caller's error message, if requested + if (ErrMsg) + *ErrMsg = ErrorMsg; + // Indicate an error occurred return true; + } LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.begin(); LazyFunctionMap::iterator Fe = LazyFunctionLoadMap.end(); -- cgit v1.2.3-18-g5258