summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-11-13 07:00:17 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-11-13 07:00:17 +0000
commitd9445c49ad47c227f5981ad1f8f211dff9aaa9f1 (patch)
tree81677338f0d0d86208f35bc7cf3acbc898999a71 /llvm/lib
parent8dff03911c5efa7a3abd6fb43f09233758075b20 (diff)
downloadbcm5719-llvm-d9445c49ad47c227f5981ad1f8f211dff9aaa9f1.tar.gz
bcm5719-llvm-d9445c49ad47c227f5981ad1f8f211dff9aaa9f1.zip
Bitcode: Change module reader functions to return an llvm::Expected.
Differential Revision: https://reviews.llvm.org/D26562 llvm-svn: 286752
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Bitcode/Reader/BitReader.cpp49
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp18
-rw-r--r--llvm/lib/CodeGen/ParallelCG.cpp2
-rw-r--r--llvm/lib/IRReader/IRReader.cpp20
-rw-r--r--llvm/lib/LTO/LTO.cpp46
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp8
-rw-r--r--llvm/lib/LTO/LTOModule.cpp14
-rw-r--r--llvm/lib/Object/IRObjectFile.cpp10
-rw-r--r--llvm/lib/Object/SymbolicFile.cpp8
-rw-r--r--llvm/lib/Transforms/IPO/FunctionImport.cpp5
10 files changed, 77 insertions, 103 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitReader.cpp b/llvm/lib/Bitcode/Reader/BitReader.cpp
index 8aa82bfc5ee..63854307b7b 100644
--- a/llvm/lib/Bitcode/Reader/BitReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitReader.cpp
@@ -34,13 +34,6 @@ LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf,
return LLVMParseBitcodeInContext2(LLVMGetGlobalContext(), MemBuf, OutModule);
}
-static void diagnosticHandler(const DiagnosticInfo &DI, void *C) {
- auto *Message = reinterpret_cast<std::string *>(C);
- raw_string_ostream Stream(*Message);
- DiagnosticPrinterRawOStream DP(Stream);
- DI.print(DP);
-}
-
LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule,
@@ -48,17 +41,12 @@ LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
MemoryBufferRef Buf = unwrap(MemBuf)->getMemBufferRef();
LLVMContext &Ctx = *unwrap(ContextRef);
- LLVMContext::DiagnosticHandlerTy OldDiagnosticHandler =
- Ctx.getDiagnosticHandler();
- void *OldDiagnosticContext = Ctx.getDiagnosticContext();
- std::string Message;
- Ctx.setDiagnosticHandler(diagnosticHandler, &Message, true);
-
- ErrorOr<std::unique_ptr<Module>> ModuleOrErr = parseBitcodeFile(Buf, Ctx);
-
- Ctx.setDiagnosticHandler(OldDiagnosticHandler, OldDiagnosticContext, true);
-
- if (ModuleOrErr.getError()) {
+ Expected<std::unique_ptr<Module>> ModuleOrErr = parseBitcodeFile(Buf, Ctx);
+ if (Error Err = ModuleOrErr.takeError()) {
+ std::string Message;
+ handleAllErrors(std::move(Err), [&](ErrorInfoBase &EIB) {
+ Message = EIB.message();
+ });
if (OutMessage)
*OutMessage = strdup(Message.c_str());
*OutModule = wrap((Module *)nullptr);
@@ -75,7 +63,8 @@ LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef,
MemoryBufferRef Buf = unwrap(MemBuf)->getMemBufferRef();
LLVMContext &Ctx = *unwrap(ContextRef);
- ErrorOr<std::unique_ptr<Module>> ModuleOrErr = parseBitcodeFile(Buf, Ctx);
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr =
+ expectedToErrorOrAndEmitErrors(Ctx, parseBitcodeFile(Buf, Ctx));
if (ModuleOrErr.getError()) {
*OutModule = wrap((Module *)nullptr);
return 1;
@@ -92,23 +81,19 @@ LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutM, char **OutMessage) {
LLVMContext &Ctx = *unwrap(ContextRef);
- LLVMContext::DiagnosticHandlerTy OldDiagnosticHandler =
- Ctx.getDiagnosticHandler();
- void *OldDiagnosticContext = Ctx.getDiagnosticContext();
-
- std::string Message;
- Ctx.setDiagnosticHandler(diagnosticHandler, &Message, true);
std::unique_ptr<MemoryBuffer> Owner(unwrap(MemBuf));
-
- ErrorOr<std::unique_ptr<Module>> ModuleOrErr =
+ Expected<std::unique_ptr<Module>> ModuleOrErr =
getOwningLazyBitcodeModule(std::move(Owner), Ctx);
Owner.release();
- Ctx.setDiagnosticHandler(OldDiagnosticHandler, OldDiagnosticContext, true);
- if (ModuleOrErr.getError()) {
- *OutM = wrap((Module *)nullptr);
+ if (Error Err = ModuleOrErr.takeError()) {
+ std::string Message;
+ handleAllErrors(std::move(Err), [&](ErrorInfoBase &EIB) {
+ Message = EIB.message();
+ });
if (OutMessage)
*OutMessage = strdup(Message.c_str());
+ *OutM = wrap((Module *)nullptr);
return 1;
}
@@ -123,8 +108,8 @@ LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef,
LLVMContext &Ctx = *unwrap(ContextRef);
std::unique_ptr<MemoryBuffer> Owner(unwrap(MemBuf));
- ErrorOr<std::unique_ptr<Module>> ModuleOrErr =
- getOwningLazyBitcodeModule(std::move(Owner), Ctx);
+ ErrorOr<std::unique_ptr<Module>> ModuleOrErr = expectedToErrorOrAndEmitErrors(
+ Ctx, getOwningLazyBitcodeModule(std::move(Owner), Ctx));
Owner.release();
if (ModuleOrErr.getError()) {
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 2c81d1343ce..bf1f6a56fa1 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -6571,13 +6571,13 @@ const std::error_category &llvm::BitcodeErrorCategory() {
///
/// \param[in] MaterializeAll Set to \c true if we should materialize
/// everything.
-static ErrorOr<std::unique_ptr<Module>>
+static Expected<std::unique_ptr<Module>>
getLazyBitcodeModuleImpl(MemoryBufferRef Buffer, LLVMContext &Context,
bool MaterializeAll,
bool ShouldLazyLoadMetadata = false) {
Expected<BitstreamCursor> StreamOrErr = initStream(Buffer);
if (!StreamOrErr)
- return errorToErrorCodeAndEmitErrors(Context, StreamOrErr.takeError());
+ return StreamOrErr.takeError();
BitcodeReader *R = new BitcodeReader(std::move(*StreamOrErr), Context);
@@ -6587,28 +6587,28 @@ getLazyBitcodeModuleImpl(MemoryBufferRef Buffer, LLVMContext &Context,
// Delay parsing Metadata if ShouldLazyLoadMetadata is true.
if (Error Err = R->parseBitcodeInto(M.get(), ShouldLazyLoadMetadata))
- return errorToErrorCodeAndEmitErrors(Context, std::move(Err));
+ return std::move(Err);
if (MaterializeAll) {
// Read in the entire module, and destroy the BitcodeReader.
if (Error Err = M->materializeAll())
- return errorToErrorCodeAndEmitErrors(Context, std::move(Err));
+ return std::move(Err);
} else {
// Resolve forward references from blockaddresses.
if (Error Err = R->materializeForwardReferencedFunctions())
- return errorToErrorCodeAndEmitErrors(Context, std::move(Err));
+ return std::move(Err);
}
return std::move(M);
}
-ErrorOr<std::unique_ptr<Module>>
+Expected<std::unique_ptr<Module>>
llvm::getLazyBitcodeModule(MemoryBufferRef Buffer,
LLVMContext &Context, bool ShouldLazyLoadMetadata) {
return getLazyBitcodeModuleImpl(Buffer, Context, false,
ShouldLazyLoadMetadata);
}
-ErrorOr<std::unique_ptr<Module>>
+Expected<std::unique_ptr<Module>>
llvm::getOwningLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buffer,
LLVMContext &Context,
bool ShouldLazyLoadMetadata) {
@@ -6618,8 +6618,8 @@ llvm::getOwningLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buffer,
return MOrErr;
}
-ErrorOr<std::unique_ptr<Module>> llvm::parseBitcodeFile(MemoryBufferRef Buffer,
- LLVMContext &Context) {
+Expected<std::unique_ptr<Module>> llvm::parseBitcodeFile(MemoryBufferRef Buffer,
+ LLVMContext &Context) {
return getLazyBitcodeModuleImpl(Buffer, Context, true);
// TODO: Restore the use-lists to the in-memory state when the bitcode was
// written. We must defer until the Module has been fully materialized.
diff --git a/llvm/lib/CodeGen/ParallelCG.cpp b/llvm/lib/CodeGen/ParallelCG.cpp
index 19c72977cb6..50dd44fa659 100644
--- a/llvm/lib/CodeGen/ParallelCG.cpp
+++ b/llvm/lib/CodeGen/ParallelCG.cpp
@@ -79,7 +79,7 @@ std::unique_ptr<Module> llvm::splitCodeGen(
CodegenThreadPool.async(
[TMFactory, FileType, ThreadOS](const SmallString<0> &BC) {
LLVMContext Ctx;
- ErrorOr<std::unique_ptr<Module>> MOrErr = parseBitcodeFile(
+ Expected<std::unique_ptr<Module>> MOrErr = parseBitcodeFile(
MemoryBufferRef(StringRef(BC.data(), BC.size()),
"<split-module>"),
Ctx);
diff --git a/llvm/lib/IRReader/IRReader.cpp b/llvm/lib/IRReader/IRReader.cpp
index c6ad3129799..cb29a2552ea 100644
--- a/llvm/lib/IRReader/IRReader.cpp
+++ b/llvm/lib/IRReader/IRReader.cpp
@@ -34,11 +34,13 @@ getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err,
LLVMContext &Context, bool ShouldLazyLoadMetadata) {
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
(const unsigned char *)Buffer->getBufferEnd())) {
- ErrorOr<std::unique_ptr<Module>> ModuleOrErr = getOwningLazyBitcodeModule(
+ Expected<std::unique_ptr<Module>> ModuleOrErr = getOwningLazyBitcodeModule(
std::move(Buffer), Context, ShouldLazyLoadMetadata);
- if (std::error_code EC = ModuleOrErr.getError()) {
- Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error,
- EC.message());
+ if (Error E = ModuleOrErr.takeError()) {
+ handleAllErrors(std::move(E), [&](ErrorInfoBase &EIB) {
+ Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error,
+ EIB.message());
+ });
return nullptr;
}
return std::move(ModuleOrErr.get());
@@ -69,11 +71,13 @@ std::unique_ptr<Module> llvm::parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
TimePassesIsEnabled);
if (isBitcode((const unsigned char *)Buffer.getBufferStart(),
(const unsigned char *)Buffer.getBufferEnd())) {
- ErrorOr<std::unique_ptr<Module>> ModuleOrErr =
+ Expected<std::unique_ptr<Module>> ModuleOrErr =
parseBitcodeFile(Buffer, Context);
- if (std::error_code EC = ModuleOrErr.getError()) {
- Err = SMDiagnostic(Buffer.getBufferIdentifier(), SourceMgr::DK_Error,
- EC.message());
+ if (Error E = ModuleOrErr.takeError()) {
+ handleAllErrors(std::move(E), [&](ErrorInfoBase &EIB) {
+ Err = SMDiagnostic(Buffer.getBufferIdentifier(), SourceMgr::DK_Error,
+ EIB.message());
+ });
return nullptr;
}
return std::move(ModuleOrErr.get());
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index cf40bfd4ebc..f867582454d 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -104,17 +104,16 @@ std::unique_ptr<Module>
llvm::loadModuleFromBuffer(const MemoryBufferRef &Buffer, LLVMContext &Context,
bool Lazy) {
SMDiagnostic Err;
- ErrorOr<std::unique_ptr<Module>> ModuleOrErr(nullptr);
- if (Lazy) {
- ModuleOrErr = getLazyBitcodeModule(Buffer, Context,
- /* ShouldLazyLoadMetadata */ Lazy);
- } else {
- ModuleOrErr = parseBitcodeFile(Buffer, Context);
- }
- if (std::error_code EC = ModuleOrErr.getError()) {
- Err = SMDiagnostic(Buffer.getBufferIdentifier(), SourceMgr::DK_Error,
- EC.message());
- Err.print("ThinLTO", errs());
+ Expected<std::unique_ptr<Module>> ModuleOrErr =
+ Lazy ? getLazyBitcodeModule(Buffer, Context,
+ /* ShouldLazyLoadMetadata */ true)
+ : parseBitcodeFile(Buffer, Context);
+ if (!ModuleOrErr) {
+ handleAllErrors(ModuleOrErr.takeError(), [&](ErrorInfoBase &EIB) {
+ SMDiagnostic Err = SMDiagnostic(Buffer.getBufferIdentifier(),
+ SourceMgr::DK_Error, EIB.message());
+ Err.print("ThinLTO", errs());
+ });
report_fatal_error("Can't load module, abort.");
}
return std::move(ModuleOrErr.get());
@@ -204,25 +203,13 @@ void llvm::thinLTOInternalizeAndPromoteInIndex(
Expected<std::unique_ptr<InputFile>> InputFile::create(MemoryBufferRef Object) {
std::unique_ptr<InputFile> File(new InputFile);
- std::string Msg;
- auto DiagHandler = [](const DiagnosticInfo &DI, void *MsgP) {
- auto *Msg = reinterpret_cast<std::string *>(MsgP);
- raw_string_ostream OS(*Msg);
- DiagnosticPrinterRawOStream DP(OS);
- DI.print(DP);
- };
- File->Ctx.setDiagnosticHandler(DiagHandler, static_cast<void *>(&Msg));
- ErrorOr<std::unique_ptr<object::IRObjectFile>> IRObj =
+ Expected<std::unique_ptr<object::IRObjectFile>> IRObj =
IRObjectFile::create(Object, File->Ctx);
- if (!Msg.empty())
- return make_error<StringError>(Msg, inconvertibleErrorCode());
if (!IRObj)
- return errorCodeToError(IRObj.getError());
+ return IRObj.takeError();
File->Obj = std::move(*IRObj);
- File->Ctx.setDiagnosticHandler(nullptr, nullptr);
-
for (const auto &C : File->Obj->getModule().getComdatSymbolTable()) {
auto P =
File->ComdatMap.insert(std::make_pair(&C.second, File->Comdats.size()));
@@ -346,10 +333,10 @@ Error LTO::addRegularLTO(std::unique_ptr<InputFile> Input,
llvm::make_unique<Module>("ld-temp.o", RegularLTO.Ctx);
RegularLTO.Mover = llvm::make_unique<IRMover>(*RegularLTO.CombinedModule);
}
- ErrorOr<std::unique_ptr<object::IRObjectFile>> ObjOrErr =
+ Expected<std::unique_ptr<object::IRObjectFile>> ObjOrErr =
IRObjectFile::create(Input->Obj->getMemoryBufferRef(), RegularLTO.Ctx);
if (!ObjOrErr)
- return errorCodeToError(ObjOrErr.getError());
+ return ObjOrErr.takeError();
std::unique_ptr<object::IRObjectFile> Obj = std::move(*ObjOrErr);
Module &M = Obj->getModule();
@@ -571,9 +558,10 @@ public:
MapVector<StringRef, MemoryBufferRef> &ModuleMap) {
auto RunThinBackend = [&](AddStreamFn AddStream) {
LTOLLVMContext BackendContext(Conf);
- ErrorOr<std::unique_ptr<Module>> MOrErr =
+ Expected<std::unique_ptr<Module>> MOrErr =
parseBitcodeFile(MBRef, BackendContext);
- assert(MOrErr && "Unable to load module in thread?");
+ if (!MOrErr)
+ return MOrErr.takeError();
return thinBackend(Conf, Task, AddStream, **MOrErr, CombinedIndex,
ImportList, DefinedGlobals, ModuleMap);
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 739d367f03e..be9009e19c3 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -237,7 +237,7 @@ void splitCodeGen(Config &C, TargetMachine *TM, AddStreamFn AddStream,
CodegenThreadPool.async(
[&](const SmallString<0> &BC, unsigned ThreadId) {
LTOLLVMContext Ctx(C);
- ErrorOr<std::unique_ptr<Module>> MOrErr = parseBitcodeFile(
+ Expected<std::unique_ptr<Module>> MOrErr = parseBitcodeFile(
MemoryBufferRef(StringRef(BC.data(), BC.size()), "ld-temp.o"),
Ctx);
if (!MOrErr)
@@ -353,10 +353,8 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream,
auto ModuleLoader = [&](StringRef Identifier) {
assert(Mod.getContext().isODRUniquingDebugTypes() &&
"ODR Type uniquing should be enabled on the context");
- return std::move(getLazyBitcodeModule(ModuleMap[Identifier],
- Mod.getContext(),
- /*ShouldLazyLoadMetadata=*/true)
- .get());
+ return getLazyBitcodeModule(ModuleMap[Identifier], Mod.getContext(),
+ /*ShouldLazyLoadMetadata=*/true);
};
FunctionImporter Importer(CombinedIndex, ModuleLoader);
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index ef1c93a4d71..876b43d08ca 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -184,18 +184,14 @@ parseBitcodeFileImpl(MemoryBufferRef Buffer, LLVMContext &Context,
if (!ShouldBeLazy) {
// Parse the full file.
- ErrorOr<std::unique_ptr<Module>> M = parseBitcodeFile(*MBOrErr, Context);
- if (std::error_code EC = M.getError())
- return EC;
- return std::move(*M);
+ return expectedToErrorOrAndEmitErrors(Context,
+ parseBitcodeFile(*MBOrErr, Context));
}
// Parse lazily.
- ErrorOr<std::unique_ptr<Module>> M =
- getLazyBitcodeModule(*MBOrErr, Context, true /*ShouldLazyLoadMetadata*/);
- if (std::error_code EC = M.getError())
- return EC;
- return std::move(*M);
+ return expectedToErrorOrAndEmitErrors(
+ Context,
+ getLazyBitcodeModule(*MBOrErr, Context, true /*ShouldLazyLoadMetadata*/));
}
ErrorOr<std::unique_ptr<LTOModule>>
diff --git a/llvm/lib/Object/IRObjectFile.cpp b/llvm/lib/Object/IRObjectFile.cpp
index c2b4b289315..535ddb91935 100644
--- a/llvm/lib/Object/IRObjectFile.cpp
+++ b/llvm/lib/Object/IRObjectFile.cpp
@@ -310,18 +310,18 @@ ErrorOr<MemoryBufferRef> IRObjectFile::findBitcodeInMemBuffer(MemoryBufferRef Ob
}
}
-ErrorOr<std::unique_ptr<IRObjectFile>>
+Expected<std::unique_ptr<IRObjectFile>>
llvm::object::IRObjectFile::create(MemoryBufferRef Object,
LLVMContext &Context) {
ErrorOr<MemoryBufferRef> BCOrErr = findBitcodeInMemBuffer(Object);
if (!BCOrErr)
- return BCOrErr.getError();
+ return errorCodeToError(BCOrErr.getError());
- ErrorOr<std::unique_ptr<Module>> MOrErr =
+ Expected<std::unique_ptr<Module>> MOrErr =
getLazyBitcodeModule(*BCOrErr, Context,
/*ShouldLazyLoadMetadata*/ true);
- if (std::error_code EC = MOrErr.getError())
- return EC;
+ if (!MOrErr)
+ return MOrErr.takeError();
std::unique_ptr<Module> &M = MOrErr.get();
return llvm::make_unique<IRObjectFile>(BCOrErr.get(), std::move(M));
diff --git a/llvm/lib/Object/SymbolicFile.cpp b/llvm/lib/Object/SymbolicFile.cpp
index 31d41e661cb..bedca667f3c 100644
--- a/llvm/lib/Object/SymbolicFile.cpp
+++ b/llvm/lib/Object/SymbolicFile.cpp
@@ -35,7 +35,7 @@ Expected<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
switch (Type) {
case sys::fs::file_magic::bitcode:
if (Context)
- return errorOrToExpected(IRObjectFile::create(Object, *Context));
+ return IRObjectFile::create(Object, *Context);
LLVM_FALLTHROUGH;
case sys::fs::file_magic::unknown:
case sys::fs::file_magic::archive:
@@ -73,9 +73,9 @@ Expected<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
if (!BCData)
return std::move(Obj);
- return errorOrToExpected(IRObjectFile::create(
- MemoryBufferRef(BCData->getBuffer(),
- Object.getBufferIdentifier()), *Context));
+ return IRObjectFile::create(
+ MemoryBufferRef(BCData->getBuffer(), Object.getBufferIdentifier()),
+ *Context);
}
}
llvm_unreachable("Unexpected Binary File Type");
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 2a351b30119..3bebc609bea 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -624,7 +624,10 @@ Expected<bool> FunctionImporter::importFunctions(
// Get the module for the import
const auto &FunctionsToImportPerModule = ImportList.find(Name);
assert(FunctionsToImportPerModule != ImportList.end());
- std::unique_ptr<Module> SrcModule = ModuleLoader(Name);
+ Expected<std::unique_ptr<Module>> SrcModuleOrErr = ModuleLoader(Name);
+ if (!SrcModuleOrErr)
+ return SrcModuleOrErr.takeError();
+ std::unique_ptr<Module> SrcModule = std::move(*SrcModuleOrErr);
assert(&DestModule.getContext() == &SrcModule->getContext() &&
"Context mismatch");
OpenPOWER on IntegriCloud