From cc863b2bb6bb018416a65b2f9666ca9dd07dcae5 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 16 Oct 2011 16:30:34 +0000 Subject: Let printf do the formatting instead aligning strings ourselves. While at it, merge some format strings. llvm-svn: 142140 --- llvm/lib/MC/SubtargetFeature.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'llvm/lib/MC/SubtargetFeature.cpp') diff --git a/llvm/lib/MC/SubtargetFeature.cpp b/llvm/lib/MC/SubtargetFeature.cpp index 348cd4c9ab1..4f23a85d62e 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 @@ -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); } -- cgit v1.2.3