diff options
author | Eli Bendersky <eliben@google.com> | 2015-06-12 23:26:42 +0000 |
---|---|---|
committer | Eli Bendersky <eliben@google.com> | 2015-06-12 23:26:42 +0000 |
commit | ff715e2d5ec91e971daa70fdcfc153903030cd15 (patch) | |
tree | 0f1057d8c7051b460e51462df30be4b035963b14 /llvm/lib/Linker/LinkModules.cpp | |
parent | 37cc9fadd5932a60bd708a1b260dea5a999ee668 (diff) | |
download | bcm5719-llvm-ff715e2d5ec91e971daa70fdcfc153903030cd15.tar.gz bcm5719-llvm-ff715e2d5ec91e971daa70fdcfc153903030cd15.zip |
Fix returning error message in LLVMLinkModules
On error, the temporary output stream wouldn't be flushed and therefore the
caller would see an empty error message.
Patch by Antoine Pitrou
Differential Revision: http://reviews.llvm.org/D10241
llvm-svn: 239646
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 1b7a33168f1..b47d2685d42 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -1802,7 +1802,9 @@ LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src, LLVMBool Result = Linker::LinkModules( D, unwrap(Src), [&](const DiagnosticInfo &DI) { DI.print(DP); }); - if (OutMessages && Result) + if (OutMessages && Result) { + Stream.flush(); *OutMessages = strdup(Message.c_str()); + } return Result; } |