summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-15 19:49:23 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-15 19:49:23 +0000
commit5dd391b4bb70e1ed88331b1d0316da97f29c038a (patch)
treede0e916d86ab70b911d49c154903e518dcec163f /llvm/lib/Bytecode/Reader/Reader.cpp
parent1c6cb06ff573a410dfe0c256868b23ba502efbab (diff)
downloadbcm5719-llvm-5dd391b4bb70e1ed88331b1d0316da97f29c038a.tar.gz
bcm5719-llvm-5dd391b4bb70e1ed88331b1d0316da97f29c038a.zip
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. llvm-svn: 32608
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index e2ab8c10e67..1c747af948c 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud