aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/SubtargetFeature.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-10-16 16:30:34 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-10-16 16:30:34 +0000
commitcc863b2bb6bb018416a65b2f9666ca9dd07dcae5 (patch)
treee2838a4c105b98d41a5e9822d05095aa84ca25e8 /llvm/lib/MC/SubtargetFeature.cpp
parentcb6b02a0866b568dd83c74daddf570bade449191 (diff)
downloadllvm-cc863b2bb6bb018416a65b2f9666ca9dd07dcae5.zip
llvm-cc863b2bb6bb018416a65b2f9666ca9dd07dcae5.tar.gz
llvm-cc863b2bb6bb018416a65b2f9666ca9dd07dcae5.tar.bz2
Let printf do the formatting instead aligning strings ourselves.
While at it, merge some format strings. llvm-svn: 142140
Diffstat (limited to 'llvm/lib/MC/SubtargetFeature.cpp')
-rw-r--r--llvm/lib/MC/SubtargetFeature.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/lib/MC/SubtargetFeature.cpp b/llvm/lib/MC/SubtargetFeature.cpp
index 348cd4c..4f23a85 100644
--- a/llvm/lib/MC/SubtargetFeature.cpp
+++ b/llvm/lib/MC/SubtargetFeature.cpp
@@ -13,6 +13,7 @@
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/StringExtras.h"
#include <algorithm>
@@ -154,21 +155,19 @@ static void Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize,
// Print the CPU table.
errs() << "Available CPUs for this target:\n\n";
for (size_t i = 0; i != CPUTableSize; i++)
- errs() << " " << CPUTable[i].Key
- << std::string(MaxCPULen - std::strlen(CPUTable[i].Key), ' ')
- << " - " << CPUTable[i].Desc << ".\n";
- errs() << "\n";
-
+ errs() << format(" %-*s - %s.\n",
+ MaxCPULen, CPUTable[i].Key, CPUTable[i].Desc);
+ errs() << '\n';
+
// Print the Feature table.
errs() << "Available features for this target:\n\n";
for (size_t i = 0; i != FeatTableSize; i++)
- errs() << " " << FeatTable[i].Key
- << std::string(MaxFeatLen - std::strlen(FeatTable[i].Key), ' ')
- << " - " << FeatTable[i].Desc << ".\n";
- errs() << "\n";
-
+ errs() << format(" %-*s - %s.\n",
+ MaxFeatLen, FeatTable[i].Key, FeatTable[i].Desc);
+ errs() << '\n';
+
errs() << "Use +feature to enable a feature, or -feature to disable it.\n"
- << "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
+ "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
std::exit(1);
}