libLTO: Assert if LTOCodeGenerator and LTOModule are from different contexts
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 11 Nov 2014 23:13:10 +0000 (23:13 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 11 Nov 2014 23:13:10 +0000 (23:13 +0000)
llvm-svn: 221730

llvm/lib/LTO/LTOCodeGenerator.cpp

index 31ab340..c663d43 100644 (file)
@@ -128,6 +128,9 @@ void LTOCodeGenerator::initializeLTOPasses() {
 }
 
 bool LTOCodeGenerator::addModule(LTOModule *mod) {
+  assert(&mod->getModule().getContext() == &Context &&
+         "Expected module in same context");
+
   bool ret = IRLinker.linkInModule(&mod->getModule());
 
   const std::vector<const char*> &undefs = mod->getAsmUndefinedRefs();