For PR351: \
[oota-llvm.git] / include / llvm / Support / PassNameParser.h
index 43561ec671b6247254a6e2246c726132e3f54339..71ebe41a459a0e0768050a956186e409ff72a60e 100644 (file)
@@ -1,4 +1,11 @@
 //===- llvm/Support/PassNameParser.h ----------------------------*- C++ -*-===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // This file the PassNameParser and FilteredPassNameParser<> classes, which are
 // used to add command line arguments to a utility for all of the passes that
 #ifndef LLVM_SUPPORT_PASS_NAME_PARSER_H
 #define LLVM_SUPPORT_PASS_NAME_PARSER_H
 
-#include "Support/CommandLine.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Pass.h"
 #include <algorithm>
+#include <iostream>
+
+namespace llvm {
 
 //===----------------------------------------------------------------------===//
 // PassNameParser class - Make use of the pass registration mechanism to
@@ -47,8 +57,7 @@ public:
     // Ignore non-selectable and non-constructible passes!  Ignore
     // non-optimizations.
     return P->getPassArgument() == 0 || *P->getPassArgument() == 0 ||
-          (P->getNormalCtor() == 0 && P->getDataCtor() == 0 &&
-           P->getTargetCtor() == 0) ||
+          (P->getNormalCtor() == 0 && P->getTargetCtor() == 0) ||
           ignorablePassImpl(P);
   }
 
@@ -56,8 +65,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());
   }
@@ -104,4 +116,6 @@ struct FilteredPassNameParser : public PassNameParser {
   }
 };
 
+} // End llvm namespace
+
 #endif