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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221730 91177308-0d34-0410-b5e6-96231b3b80d8

lib/LTO/LTOCodeGenerator.cpp

index 31ab3401c9dc8a8c6cd0761667cbb0c4ff0bd005..c663d43fe7fdec56979651a2bde5f3052427c54a 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();