From 9d0239e9cc8d75797968c662d32afb8efbaed0f0 Mon Sep 17 00:00:00 2001 From: Manuel Ullmann Date: Mon, 2 Jan 2023 06:44:48 +0100 Subject: [PATCH] ignore commandline inconsistencies --- llvm/lib/Support/CommandLine.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 5e7d6316..8d122b75 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -43,6 +43,7 @@ #include "llvm/Support/Process.h" #include "llvm/Support/StringSaver.h" #include "llvm/Support/VirtualFileSystem.h" +#include "llvm/Support/WithColor.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -181,9 +182,9 @@ public: if (Opt.hasArgStr()) return; if (!SC->OptionsMap.insert(std::make_pair(Name, &Opt)).second) { - errs() << ProgramName << ": CommandLine Error: Option '" << Name + WithColor::warning() << ProgramName << ": CommandLine Error: Option '" << Name << "' registered more than once!\n"; - report_fatal_error("inconsistency in registered CommandLine options"); + WithColor::warning() << "inconsistency in registered CommandLine options\n"; } // If we're adding this to all sub-commands, add it to the ones that have @@ -216,7 +217,7 @@ public: // Add argument to the argument map! if (!SC->OptionsMap.insert(std::make_pair(O->ArgStr, O)).second) { - errs() << ProgramName << ": CommandLine Error: Option '" << O->ArgStr + WithColor::warning() << ProgramName << ": CommandLine Error: Option '" << O->ArgStr << "' registered more than once!\n"; HadErrors = true; } @@ -239,8 +240,10 @@ public: // indicate serious issues such as conflicting option names or an // incorrectly // linked LLVM distribution. - if (HadErrors) - report_fatal_error("inconsistency in registered CommandLine options"); + if (HadErrors) { + WithColor::warning() << "inconsistency in registered CommandLine options\n"; + HadErrors = false; + } // If we're adding this to all sub-commands, add it to the ones that have // already been registered. @@ -332,9 +335,9 @@ public: void updateArgStr(Option *O, StringRef NewName, SubCommand *SC) { SubCommand &Sub = *SC; if (!Sub.OptionsMap.insert(std::make_pair(NewName, O)).second) { - errs() << ProgramName << ": CommandLine Error: Option '" << O->ArgStr + WithColor::warning() << ProgramName << ": CommandLine Error: Option '" << O->ArgStr << "' registered more than once!\n"; - report_fatal_error("inconsistency in registered CommandLine options"); + WithColor::warning() << "inconsistency in registered CommandLine options\n"; } Sub.OptionsMap.erase(O->ArgStr); } -- 2.38.2