summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/SubtargetFeature.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-05-05 22:01:47 +0000
committerEric Christopher <echristo@gmail.com>2014-05-05 22:01:47 +0000
commitfbed044fa3873199bc91f30a4619ec22a8ddf781 (patch)
treecf8f067c6e1d2e017496d0996db9dba848b0f18a /llvm/lib/MC/SubtargetFeature.cpp
parent26d56393c602df63526e878dbc5cca453601e9c5 (diff)
downloadbcm5719-llvm-fbed044fa3873199bc91f30a4619ec22a8ddf781.tar.gz
bcm5719-llvm-fbed044fa3873199bc91f30a4619ec22a8ddf781.zip
Remove a call to std::exit in a library. Make "Help" return
a 0 as a default answer. llvm-svn: 208009
Diffstat (limited to 'llvm/lib/MC/SubtargetFeature.cpp')
-rw-r--r--llvm/lib/MC/SubtargetFeature.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/MC/SubtargetFeature.cpp b/llvm/lib/MC/SubtargetFeature.cpp
index ca2ad7a8135..b7920e40739 100644
--- a/llvm/lib/MC/SubtargetFeature.cpp
+++ b/llvm/lib/MC/SubtargetFeature.cpp
@@ -142,8 +142,9 @@ static size_t getLongestEntryLength(const SubtargetFeatureKV *Table,
/// 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 SubtargetFeatureKV *CPUTable, size_t CPUTableSize,
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::getFeatureBits(const StringRef CPU,
// 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::getFeatureBits(const StringRef CPU,
// Check for help
if (Feature == "+help")
- Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize);
+ return Help(CPUTable, CPUTableSize, FeatureTable, FeatureTableSize);
// Find feature in table.
const SubtargetFeatureKV *FeatureEntry =
OpenPOWER on IntegriCloud