Give better error message if two passes of the same argument are registered
authorChris Lattner <sabre@nondot.org>
Sat, 7 Dec 2002 04:41:22 +0000 (04:41 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 7 Dec 2002 04:41:22 +0000 (04:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4950 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/PassNameParser.h

index 43561ec671b6247254a6e2246c726132e3f54339..c35f762cb8d4d4fdbeea23da1e843d2ae09de03c 100644 (file)
@@ -19,6 +19,7 @@
 #include "Support/CommandLine.h"
 #include "llvm/Pass.h"
 #include <algorithm>
+#include <iostream>
 
 //===----------------------------------------------------------------------===//
 // PassNameParser class - Make use of the pass registration mechanism to
@@ -56,8 +57,11 @@ public:
   //
   virtual void passRegistered(const PassInfo *P) {
     if (ignorablePass(P) || !Opt) return;
-    assert(findOption(P->getPassArgument()) == getNumOptions() &&
-           "Two passes with the same argument attempted to be registered!");
+    if (findOption(P->getPassArgument()) != getNumOptions()) {
+      std::cerr << "Two passes with the same argument (-"
+                << P->getPassArgument() << ") attempted to be registered!\n";
+      abort();
+    }
     addLiteralOption(P->getPassArgument(), P, P->getPassName());
     Opt->addArgument(P->getPassArgument());
   }