summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2015-06-12 23:26:42 +0000
committerEli Bendersky <eliben@google.com>2015-06-12 23:26:42 +0000
commitff715e2d5ec91e971daa70fdcfc153903030cd15 (patch)
tree0f1057d8c7051b460e51462df30be4b035963b14 /llvm/lib/Linker/LinkModules.cpp
parent37cc9fadd5932a60bd708a1b260dea5a999ee668 (diff)
downloadbcm5719-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.cpp4
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;
}
OpenPOWER on IntegriCloud