diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-10-16 16:30:34 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-10-16 16:30:34 +0000 |
commit | 962bad70f4277841cf6278306caa93ebce304b48 (patch) | |
tree | f8e798ee4db25f43337848f01fcc09b276b9d3e1 /lib/MC | |
parent | 47b8798c0bf0944b24051bc21d85d93a2732676a (diff) | |
download | external_llvm-962bad70f4277841cf6278306caa93ebce304b48.zip external_llvm-962bad70f4277841cf6278306caa93ebce304b48.tar.gz external_llvm-962bad70f4277841cf6278306caa93ebce304b48.tar.bz2 |
Let printf do the formatting instead aligning strings ourselves.
While at it, merge some format strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/SubtargetFeature.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/MC/SubtargetFeature.cpp b/lib/MC/SubtargetFeature.cpp index 348cd4c..4f23a85 100644 --- a/lib/MC/SubtargetFeature.cpp +++ b/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); } |