[llvm] r208009 - Remove a call to std::exit in a library. Make "Help" return

Eric Christopher echristo at gmail.com
Mon May 5 15:01:48 PDT 2014


Author: echristo
Date: Mon May  5 17:01:47 2014
New Revision: 208009

URL: http://llvm.org/viewvc/llvm-project?rev=208009&view=rev
Log:
Remove a call to std::exit in a library. Make "Help" return
a 0 as a default answer.

Modified:
    llvm/trunk/lib/MC/SubtargetFeature.cpp

Modified: llvm/trunk/lib/MC/SubtargetFeature.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/SubtargetFeature.cpp?rev=208009&r1=208008&r2=208009&view=diff
==============================================================================
--- llvm/trunk/lib/MC/SubtargetFeature.cpp (original)
+++ llvm/trunk/lib/MC/SubtargetFeature.cpp Mon May  5 17:01:47 2014
@@ -142,8 +142,9 @@ static size_t getLongestEntryLength(cons
 
 /// Display help for feature choices.
 ///
-static void Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize,
-                 const SubtargetFeatureKV *FeatTable, size_t FeatTableSize) {
+static uint64_t Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize,
+                     const SubtargetFeatureKV *FeatTable,
+                     size_t FeatTableSize) {
   // Determine the length of the longest CPU and Feature entries.
   unsigned MaxCPULen  = getLongestEntryLength(CPUTable, CPUTableSize);
   unsigned MaxFeatLen = getLongestEntryLength(FeatTable, FeatTableSize);
@@ -164,7 +165,8 @@ static void Help(const SubtargetFeatureK
 
   errs() << "Use +feature to enable a feature, or -feature to disable it.\n"
             "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
-  std::exit(1);
+
+  return 0;
 }
 
 //===----------------------------------------------------------------------===//
@@ -275,7 +277,7 @@ uint64_t SubtargetFeatures::getFeatureBi
 
   // Check if help is needed
   if (CPU == "help")
-    Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize);
+    return Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize);
 
   // Find CPU entry if CPU name is specified.
   if (!CPU.empty()) {
@@ -304,7 +306,7 @@ uint64_t SubtargetFeatures::getFeatureBi
 
     // Check for help
     if (Feature == "+help")
-      Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize);
+      return Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize);
 
     // Find feature in table.
     const SubtargetFeatureKV *FeatureEntry =





More information about the llvm-commits mailing list