mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-05 17:39:16 +00:00
strength reduce further StringRef-> const char*, saving another 620 bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82372 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
55a722bf6a
commit
bc2d9d3de5
@ -28,7 +28,6 @@
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include <cerrno>
|
||||
@ -1121,6 +1120,11 @@ HHOp("help-hidden", cl::desc("Display all available options"),
|
||||
|
||||
static void (*OverrideVersionPrinter)() = 0;
|
||||
|
||||
static int TargetArraySortFn(const void *LHS, const void *RHS) {
|
||||
typedef std::pair<const char *, const Target*> pair_ty;
|
||||
return strcmp(((const pair_ty*)LHS)->first, ((const pair_ty*)RHS)->first);
|
||||
}
|
||||
|
||||
namespace {
|
||||
class VersionPrinter {
|
||||
public:
|
||||
@ -1145,18 +1149,20 @@ public:
|
||||
<< "\n"
|
||||
<< " Registered Targets:\n";
|
||||
|
||||
std::vector<std::pair<StringRef, const Target*> > Targets;
|
||||
std::vector<std::pair<const char *, const Target*> > Targets;
|
||||
size_t Width = 0;
|
||||
for (TargetRegistry::iterator it = TargetRegistry::begin(),
|
||||
ie = TargetRegistry::end(); it != ie; ++it) {
|
||||
Targets.push_back(std::make_pair(it->getName(), &*it));
|
||||
Width = std::max(Width, Targets.back().first.size());
|
||||
Width = std::max(Width, strlen(Targets.back().first));
|
||||
}
|
||||
array_pod_sort(Targets.begin(), Targets.end());
|
||||
if (!Targets.empty())
|
||||
qsort(&Targets[0], Targets.size(), sizeof(Targets[0]),
|
||||
TargetArraySortFn);
|
||||
|
||||
for (unsigned i = 0, e = Targets.size(); i != e; ++i) {
|
||||
outs() << " " << Targets[i].first;
|
||||
outs().indent(Width - Targets[i].first.size()) << " - "
|
||||
outs().indent(Width - strlen(Targets[i].first)) << " - "
|
||||
<< Targets[i].second->getShortDescription() << '\n';
|
||||
}
|
||||
if (Targets.empty())
|
||||
|
Loading…
x
Reference in New Issue
Block a user