mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
Make it easier to pass a custom diagnostic handler to the IR linker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220732 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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()) {
|
||||
|
Reference in New Issue
Block a user