+ DiagnosticPrinterRawOStream DP(errs());
+ DI.print(DP);
+ errs() << '\n';
+}
+
+static bool linkFiles(const char *argv0, LLVMContext &Context, Linker &L,
+ const cl::list<std::string> &Files,
+ bool OverrideDuplicateSymbols) {
+ for (const auto &File : Files) {
+ std::unique_ptr<Module> M = loadFile(argv0, File, Context);
+ if (!M.get()) {
+ errs() << argv0 << ": error loading file '" << File << "'\n";
+ return false;
+ }
+
+ if (verifyModule(*M, &errs())) {
+ errs() << argv0 << ": " << File << ": error: input module is broken!\n";
+ return false;
+ }
+
+ if (Verbose)
+ errs() << "Linking in '" << File << "'\n";
+
+ if (L.linkInModule(M.get(), OverrideDuplicateSymbols))
+ return false;
+ }
+
+ return true;