[llvm-commits] [llvm] r82370 - /llvm/trunk/lib/Support/CommandLine.cpp
Chris Lattner
sabre at nondot.org
Sat Sep 19 22:48:01 PDT 2009
Author: lattner
Date: Sun Sep 20 00:48:01 2009
New Revision: 82370
URL: http://llvm.org/viewvc/llvm-project?rev=82370&view=rev
Log:
switch an std::string to StringRef, shaving 400 bytes off CommandLine.o
Modified:
llvm/trunk/lib/Support/CommandLine.cpp
Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=82370&r1=82369&r2=82370&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Sun Sep 20 00:48:01 2009
@@ -1145,33 +1145,32 @@
<< "\n"
<< " Registered Targets:\n";
- std::vector<std::pair<std::string, const Target*> > Targets;
+ std::vector<std::pair<StringRef, 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.length());
+ Width = std::max(Width, Targets.back().first.size());
}
array_pod_sort(Targets.begin(), Targets.end());
for (unsigned i = 0, e = Targets.size(); i != e; ++i) {
outs() << " " << Targets[i].first;
- outs().indent(Width - Targets[i].first.length()) << " - "
+ outs().indent(Width - Targets[i].first.size()) << " - "
<< Targets[i].second->getShortDescription() << '\n';
}
if (Targets.empty())
outs() << " (none)\n";
}
void operator=(bool OptionWasSpecified) {
- if (OptionWasSpecified) {
- if (OverrideVersionPrinter == 0) {
- print();
- exit(1);
- } else {
- (*OverrideVersionPrinter)();
- exit(1);
- }
+ if (!OptionWasSpecified) return;
+
+ if (OverrideVersionPrinter == 0) {
+ print();
+ exit(1);
}
+ (*OverrideVersionPrinter)();
+ exit(1);
}
};
} // End anonymous namespace
More information about the llvm-commits
mailing list