[llvm-branch-commits] [llvm-branch] r227984 - Merging r227903:
Hans Wennborg
hans at hanshq.net
Tue Feb 3 09:23:10 PST 2015
Author: hans
Date: Tue Feb 3 11:23:10 2015
New Revision: 227984
URL: http://llvm.org/viewvc/llvm-project?rev=227984&view=rev
Log:
Merging r227903:
------------------------------------------------------------------------
r227903 | rafael | 2015-02-02 16:49:57 -0800 (Mon, 02 Feb 2015) | 1 line
Use a non-fatal diag handler in the C API. FIxes PR22368.
------------------------------------------------------------------------
Added:
llvm/branches/release_36/test/Bindings/llvm-c/Inputs/
- copied from r227903, llvm/trunk/test/Bindings/llvm-c/Inputs/
llvm/branches/release_36/test/Bindings/llvm-c/invalid-bitcode.test
- copied unchanged from r227903, llvm/trunk/test/Bindings/llvm-c/invalid-bitcode.test
Modified:
llvm/branches/release_36/ (props changed)
llvm/branches/release_36/lib/Bitcode/Reader/BitReader.cpp
Propchange: llvm/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 3 11:23:10 2015
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226664,226708,226711,226755,227005,227085,227250,227260-227261,227290,227294,227299,227319,227339,227491,227584,227603,227670,227809
+/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226664,226708,226711,226755,227005,227085,227250,227260-227261,227290,227294,227299,227319,227339,227491,227584,227603,227670,227809,227903
Modified: llvm/branches/release_36/lib/Bitcode/Reader/BitReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/Bitcode/Reader/BitReader.cpp?rev=227984&r1=227983&r2=227984&view=diff
==============================================================================
--- llvm/branches/release_36/lib/Bitcode/Reader/BitReader.cpp (original)
+++ llvm/branches/release_36/lib/Bitcode/Reader/BitReader.cpp Tue Feb 3 11:23:10 2015
@@ -9,9 +9,11 @@
#include "llvm-c/BitReader.h"
#include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
#include <cstring>
#include <string>
@@ -30,8 +32,15 @@ LLVMBool LLVMParseBitcodeInContext(LLVMC
LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule,
char **OutMessage) {
- ErrorOr<Module *> ModuleOrErr =
- parseBitcodeFile(unwrap(MemBuf)->getMemBufferRef(), *unwrap(ContextRef));
+ MemoryBufferRef Buf = unwrap(MemBuf)->getMemBufferRef();
+ LLVMContext &Ctx = *unwrap(ContextRef);
+
+ std::string Message;
+ raw_string_ostream Stream(Message);
+ DiagnosticPrinterRawOStream DP(Stream);
+
+ ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(
+ Buf, Ctx, [&](const DiagnosticInfo &DI) { DI.print(DP); });
if (std::error_code EC = ModuleOrErr.getError()) {
if (OutMessage)
*OutMessage = strdup(EC.message().c_str());
More information about the llvm-branch-commits
mailing list