R600/SI: Using SGPRs is illegal for instructions that read carry-out from VCC
[oota-llvm.git] / lib / Support / CommandLine.cpp
index 7b2a4d0270f8415fd80fa4332df71bdf7c9d8b18..b3c2614ec9648484922d851f884b0cc5a511066f 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "llvm/Support/CommandLine.h"
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringMap.h"
@@ -36,7 +35,6 @@
 #include <cerrno>
 #include <cstdlib>
 #include <map>
-#include <set>
 using namespace llvm;
 using namespace cl;
 
@@ -126,8 +124,13 @@ static ManagedStatic<OptionCatSet> RegisteredOptionCategories;
 // Initialise the general option category.
 OptionCategory llvm::cl::GeneralCategory("General options");
 
-void OptionCategory::registerCategory()
-{
+void OptionCategory::registerCategory() {
+  assert(std::count_if(RegisteredOptionCategories->begin(),
+                       RegisteredOptionCategories->end(),
+                       [this](const OptionCategory *Category) {
+                         return getName() == Category->getName();
+                       }) == 0 && "Duplicate option categories");
+
   RegisteredOptionCategories->insert(this);
 }
 
@@ -616,7 +619,7 @@ void cl::TokenizeWindowsCommandLine(StringRef Src, StringSaver &Saver,
 static bool ExpandResponseFile(const char *FName, StringSaver &Saver,
                                TokenizerCallback Tokenizer,
                                SmallVectorImpl<const char *> &NewArgv) {
-  OwningPtr<MemoryBuffer> MemBuf;
+  std::unique_ptr<MemoryBuffer> MemBuf;
   if (MemoryBuffer::getFile(FName, MemBuf))
     return false;
   StringRef Str(MemBuf->getBufferStart(), MemBuf->getBufferSize());
@@ -685,7 +688,7 @@ namespace {
         free(Dup);
       }
     }
-    const char *SaveString(const char *Str) LLVM_OVERRIDE {
+    const char *SaveString(const char *Str) override {
       char *Dup = strdup(Str);
       Dups.push_back(Dup);
       return Dup;
@@ -1484,7 +1487,7 @@ public:
     MoreHelp->clear();
 
     // Halt the program since help information was printed
-    exit(1);
+    exit(0);
   }
 };
 
@@ -1503,10 +1506,9 @@ public:
   using HelpPrinter::operator= ;
 
 protected:
-  virtual void printOptions(StrOptionPairVector &Opts, size_t MaxArgLen) {
+  void printOptions(StrOptionPairVector &Opts, size_t MaxArgLen) override {
     std::vector<OptionCategory *> SortedCategories;
     std::map<OptionCategory *, std::vector<Option *> > CategorizedOptions;
-    std::set<std::string> CategoryNames;
 
     // Collect registered option categories into vector in preparation for
     // sorting.
@@ -1514,11 +1516,6 @@ protected:
                                       E = RegisteredOptionCategories->end();
          I != E; ++I) {
       SortedCategories.push_back(*I);
-      // FIXME: Move this check to OptionCategory::registerCategory after the
-      // problem with analyzer plugins linking to llvm/Support and causing
-      // assertion on the duplicate llvm::cl::GeneralCategory is solved.
-      assert(CategoryNames.insert((*I)->getName()).second &&
-             "Duplicate option categories");
     }
 
     // Sort the different option categories alphabetically.
@@ -1726,7 +1723,7 @@ public:
 
     if (OverrideVersionPrinter != 0) {
       (*OverrideVersionPrinter)();
-      exit(1);
+      exit(0);
     }
     print();
 
@@ -1740,7 +1737,7 @@ public:
         (*I)();
     }
 
-    exit(1);
+    exit(0);
   }
 };
 } // End anonymous namespace