Creates a module and performs necessary renaming/promotion of locals
that may be exported to another module.
Split out of D15024.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254802
91177308-0d34-0410-b5e6-
96231b3b80d8
DiagnosticHandlerFunction DiagnosticHandler;
};
DiagnosticHandlerFunction DiagnosticHandler;
};
+/// Create a new module with exported local functions renamed and promoted
+/// for ThinLTO.
+std::unique_ptr<Module>
+renameModuleForThinLTO(std::unique_ptr<Module> &M,
+ const FunctionInfoIndex *Index,
+ DiagnosticHandlerFunction DiagnosticHandler);
+
} // End llvm namespace
#endif
} // End llvm namespace
#endif
return L.linkInModule(Src, Flags);
}
return L.linkInModule(Src, Flags);
}
+std::unique_ptr<Module>
+llvm::renameModuleForThinLTO(std::unique_ptr<Module> &M,
+ const FunctionInfoIndex *Index,
+ DiagnosticHandlerFunction DiagnosticHandler) {
+ std::unique_ptr<llvm::Module> RenamedModule(
+ new llvm::Module(M->getModuleIdentifier(), M->getContext()));
+ Linker L(*RenamedModule.get(), DiagnosticHandler);
+ if (L.linkInModule(*M.get(), llvm::Linker::Flags::None, Index))
+ return nullptr;
+ return RenamedModule;
+}
+
//===----------------------------------------------------------------------===//
// C API.
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
// C API.
//===----------------------------------------------------------------------===//