-// Automatically import functions in Module \p M based on the summaries index.
-//
-// The current implementation imports every called functions that exists in the
-// summaries index.
-bool FunctionImporter::importFunctions(Module &M) {
-
- bool Changed = false;
-
- /// First step is collecting the called external functions.
- StringSet<> CalledFunctions;
- SmallVector<StringRef, 64> Worklist;
- for (auto &F : M) {
- if (F.isDeclaration() || F.hasFnAttribute(Attribute::OptimizeNone))
- continue;
- findExternalCalls(F, CalledFunctions, Worklist);
- }
-
- /// Second step: for every call to an external function, try to import it.
-
- // Linker that will be used for importing function
- Linker L(M, DiagnosticHandler);