diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -40,6 +40,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 @@ -214,9 +215,8 @@ // 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; } } @@ -233,10 +233,15 @@ SC->ConsumeAfterOpt = O; } - // Fail hard if there were errors. These are strictly unrecoverable and - // indicate serious issues such as conflicting option names or an - // incorrectly - // linked LLVM distribution. + // Fail hard if there were errors. These are strictly + // unrecoverable and indicate serious issues such as conflicting + // option names or an incorrectly linked LLVM distribution. + // + // Argument mapping errors may indicate issues, but also indicate + // two libraries linking dynamically to the same libLLVM, which + // has valid use cases, e.g. simultaneously using OpenCL and + // VAAPI. Therefore it is only warned about that. + if (HadErrors) report_fatal_error("inconsistency in registered CommandLine options");