- /// \brief Link \p Src into the composite. The source is destroyed if
- /// \p Mode is DestroySource and preserved if it is PreserveSource.
- /// If \p ErrorMsg is not null, information about any error is written
- /// to it.
- /// Returns true on error.
- bool linkInModule(Module *Src, unsigned Mode);
- bool linkInModule(Module *Src) {
- return linkInModule(Src, Linker::DestroySource);
- }
+ /// \brief Link \p Src into the composite.
+ ///
+ /// Passing OverrideSymbols as true will have symbols from Src
+ /// shadow those in the Dest.
+ /// For ThinLTO function importing/exporting the \p FunctionInfoIndex
+ /// is passed. If \p FunctionsToImport is provided, only the functions that
+ /// are part of the set will be imported from the source module.
+ /// The \p ValIDToTempMDMap is populated by the linker when function
+ /// importing is performed.
+ ///
+ /// Returns true on error.
+ bool linkInModule(std::unique_ptr<Module> Src, unsigned Flags = Flags::None,
+ const FunctionInfoIndex *Index = nullptr,
+ DenseSet<const GlobalValue *> *FunctionsToImport = nullptr,
+ DenseMap<unsigned, MDNode *> *ValIDToTempMDMap = nullptr);