[llvm] 0555c9a - [llvm][support] Show name of overlapping cl option (#70108)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 19:50:20 PDT 2023


Author: Maksim Levental
Date: 2023-10-24T21:50:16-05:00
New Revision: 0555c9a095b4f820246e179310eedfd718ac454a

URL: https://github.com/llvm/llvm-project/commit/0555c9a095b4f820246e179310eedfd718ac454a
DIFF: https://github.com/llvm/llvm-project/commit/0555c9a095b4f820246e179310eedfd718ac454a.diff

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

Added: 
    

Modified: 
    llvm/include/llvm/Support/CommandLine.h

Removed: 
    


################################################################################
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