+
+/// ExistingModuleProvider - Allow conversion from a fully materialized Module
+/// into a ModuleProvider, allowing code that expects a ModuleProvider to work
+/// if we just have a Module. Note that the ModuleProvider takes ownership of
+/// the Module specified.
+struct ExistingModuleProvider : public ModuleProvider {
+ explicit ExistingModuleProvider(Module *M) {
+ TheModule = M;
+ }
+ bool materializeFunction(Function *, std::string * = 0) {
+ return false;
+ }
+ Module* materializeModule(std::string * = 0) { return TheModule; }
+};
+
+} // End llvm namespace
+