[ThinLTO] Handle bitcode without function summary sections gracefully
[oota-llvm.git] / include / llvm / IR / LegacyPassNameParser.h
index 1f6bbbcc0903af573ae43ab76753852a3fee5767..39ae80d797c707302225ee852eef168532aeefbc 100644 (file)
@@ -41,14 +41,12 @@ namespace llvm {
 //
 class PassNameParser : public PassRegistrationListener,
                        public cl::parser<const PassInfo*> {
-  cl::Option *Opt;
 public:
-  PassNameParser() : Opt(0) {}
-  virtual ~PassNameParser();
+  PassNameParser(cl::Option &O);
+  ~PassNameParser() override;
 
-  void initialize(cl::Option &O) {
-    Opt = &O;
-    cl::parser<const PassInfo*>::initialize(O);
+  void initialize() {
+    cl::parser<const PassInfo*>::initialize();
 
     // Add all of the passes to the map that got initialized before 'this' did.
     enumeratePasses();
@@ -62,18 +60,18 @@ public:
   inline bool ignorablePass(const PassInfo *P) const {
     // Ignore non-selectable and non-constructible passes!  Ignore
     // non-optimizations.
-    return P->getPassArgument() == 0 || *P->getPassArgument() == 0 ||
-           P->getNormalCtor() == 0 || ignorablePassImpl(P);
+    return P->getPassArgument() == nullptr || *P->getPassArgument() == 0 ||
+           P->getNormalCtor() == nullptr || ignorablePassImpl(P);
   }
 
   // Implement the PassRegistrationListener callbacks used to populate our map
   //
   void passRegistered(const PassInfo *P) override {
-    if (ignorablePass(P) || !Opt) return;
+    if (ignorablePass(P)) return;
     if (findOption(P->getPassArgument()) != getNumOptions()) {
       errs() << "Two passes with the same argument (-"
            << P->getPassArgument() << ") attempted to be registered!\n";
-      llvm_unreachable(0);
+      llvm_unreachable(nullptr);
     }
     addLiteralOption(P->getPassArgument(), P, P->getPassName());
   }