diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-10-27 23:02:10 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-10-27 23:02:10 +0000 |
commit | 4160f5d3ac9b5fe27726065baa8b2af730f357a7 (patch) | |
tree | 3900b3f9d5a6dd370ba743a79feedf86cdce5dd8 /llvm/tools/llvm-link | |
parent | d4b230b3780bf645991e99986a510124f64dabed (diff) | |
download | bcm5719-llvm-4160f5d3ac9b5fe27726065baa8b2af730f357a7.tar.gz bcm5719-llvm-4160f5d3ac9b5fe27726065baa8b2af730f357a7.zip |
Make it easier to pass a custom diagnostic handler to the IR linker.
llvm-svn: 220732
Diffstat (limited to 'llvm/tools/llvm-link')
-rw-r--r-- | llvm/tools/llvm-link/llvm-link.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp index c4a4e49ba74..828b9bb8ef7 100644 --- a/llvm/tools/llvm-link/llvm-link.cpp +++ b/llvm/tools/llvm-link/llvm-link.cpp @@ -71,11 +71,12 @@ loadFile(const char *argv0, const std::string &FN, LLVMContext &Context) { return Result; } -static void diagnosticHandler(const DiagnosticInfo &DI, void *Context) { +static void diagnosticHandler(const DiagnosticInfo &DI) { unsigned Severity = DI.getSeverity(); switch (Severity) { case DS_Error: errs() << "ERROR: "; + break; case DS_Warning: if (SuppressWarnings) return; @@ -88,6 +89,7 @@ static void diagnosticHandler(const DiagnosticInfo &DI, void *Context) { DiagnosticPrinterRawOStream DP(errs()); DI.print(DP); + errs() << '\n'; } int main(int argc, char **argv) { @@ -100,9 +102,8 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); auto Composite = make_unique<Module>("llvm-link", Context); - Linker L(Composite.get()); + Linker L(Composite.get(), diagnosticHandler); - Context.setDiagnosticHandler(diagnosticHandler); for (unsigned i = 0; i < InputFilenames.size(); ++i) { std::unique_ptr<Module> M = loadFile(argv[0], InputFilenames[i], Context); if (!M.get()) { |