projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make it easier to pass a custom diagnostic handler to the IR linker.
[oota-llvm.git]
/
tools
/
llvm-link
/
llvm-link.cpp
diff --git
a/tools/llvm-link/llvm-link.cpp
b/tools/llvm-link/llvm-link.cpp
index c4a4e49ba74fb46be146f2cf0b6f1b7500fce138..828b9bb8ef7016c7971585e330293e72ef3cbc80 100644
(file)
--- a/
tools/llvm-link/llvm-link.cpp
+++ b/
tools/llvm-link/llvm-link.cpp
@@
-71,11
+71,12
@@
loadFile(const char *argv0, const std::string &FN, LLVMContext &Context) {
return Result;
}
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: ";
unsigned Severity = DI.getSeverity();
switch (Severity) {
case DS_Error:
errs() << "ERROR: ";
+ break;
case DS_Warning:
if (SuppressWarnings)
return;
case DS_Warning:
if (SuppressWarnings)
return;
@@
-88,6
+89,7
@@
static void diagnosticHandler(const DiagnosticInfo &DI, void *Context) {
DiagnosticPrinterRawOStream DP(errs());
DI.print(DP);
DiagnosticPrinterRawOStream DP(errs());
DI.print(DP);
+ errs() << '\n';
}
int main(int argc, char **argv) {
}
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);
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()) {
for (unsigned i = 0; i < InputFilenames.size(); ++i) {
std::unique_ptr<Module> M = loadFile(argv[0], InputFilenames[i], Context);
if (!M.get()) {