[llvm] [llvm][support] Show name of overlapping cl option (PR #70108)

Maksim Levental via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 16:07:37 PDT 2023


https://github.com/makslevental updated https://github.com/llvm/llvm-project/pull/70108

>From 8314b316065b2d8ade8320614dc0ebb1197113f5 Mon Sep 17 00:00:00 2001
From: max <maksim.levental at gmail.com>
Date: Tue, 24 Oct 2023 14:48:16 -0500
Subject: [PATCH] [llvm][support] show name of overlapping cl opt

---
 llvm/include/llvm/Support/CommandLine.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 49f4a668ae416fe..58ef176551b6852 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -863,7 +863,10 @@ template <class DataType> class parser : public generic_parser_base {
   ///
   template <class DT>
   void addLiteralOption(StringRef Name, const DT &V, StringRef HelpStr) {
-    assert(findOption(Name) == Values.size() && "Option already exists!");
+#ifndef NDEBUG
+    if (findOption(Name) != Values.size())
+      report_fatal_error("Option " + Name + " already exists!");
+#endif
     OptionInfo X(Name, static_cast<DataType>(V), HelpStr);
     Values.push_back(X);
     AddLiteralOption(Owner, Name);



More information about the llvm-commits mailing list