questions about context


I am trying to load another bytecode file in one pass.

I checked the opt.cpp, it uses following to load a bytecode file:
   LLVMContext &Context = getGlobalContext();


   SMDiagnostic Err;

   // Load the input module...
   std::auto_ptr<Module> M;
   M.reset(ParseIRFile(InputFilename, Err, Context));

My question is in the runOnModule method where I want to load another bytecode file, what context should I use? Is getGlobalContext() still OK?


That's not necessarily the appropriate context; use M.getContext(),
where M is the Module& passed into runOnModule.