[llvm-commits] [llvm] r110485 - in /llvm/trunk/include/llvm: PassSupport.h Support/CommandLine.h Support/PassNameParser.h
Rafael Espindola
rafael.espindola at gmail.com
Fri Aug 6 16:03:52 PDT 2010
Author: rafael
Date: Fri Aug 6 18:03:52 2010
New Revision: 110485
URL: http://llvm.org/viewvc/llvm-project?rev=110485&view=rev
Log:
Some cleanup. Use a class (OptionInfo) instead of a pair of a pair and remove
some default values that are not used.
Modified:
llvm/trunk/include/llvm/PassSupport.h
llvm/trunk/include/llvm/Support/CommandLine.h
llvm/trunk/include/llvm/Support/PassNameParser.h
Modified: llvm/trunk/include/llvm/PassSupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=110485&r1=110484&r2=110485&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassSupport.h (original)
+++ llvm/trunk/include/llvm/PassSupport.h Fri Aug 6 18:03:52 2010
@@ -53,8 +53,7 @@
/// PassInfo ctor - Do not call this directly, this should only be invoked
/// through RegisterPass.
PassInfo(const char *name, const char *arg, const void *pi,
- NormalCtor_t normal = 0,
- bool isCFGOnly = false, bool is_analysis = false)
+ NormalCtor_t normal, bool isCFGOnly, bool is_analysis)
: PassName(name), PassArgument(arg), PassID(pi),
IsCFGOnlyPass(isCFGOnly),
IsAnalysis(is_analysis), IsAnalysisGroup(false), NormalCtor(normal) {
Modified: llvm/trunk/include/llvm/Support/CommandLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=110485&r1=110484&r2=110485&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CommandLine.h (original)
+++ llvm/trunk/include/llvm/Support/CommandLine.h Fri Aug 6 18:03:52 2010
@@ -443,16 +443,23 @@
template <class DataType>
class parser : public generic_parser_base {
protected:
- SmallVector<std::pair<const char *,
- std::pair<DataType, const char *> >, 8> Values;
+ class OptionInfo {
+ public:
+ OptionInfo(const char *name, DataType v, const char *helpStr) :
+ Name(name), V(v), HelpStr(helpStr) {}
+ const char *Name;
+ DataType V;
+ const char *HelpStr;
+ };
+ SmallVector<OptionInfo, 8> Values;
public:
typedef DataType parser_data_type;
// Implement virtual functions needed by generic_parser_base
unsigned getNumOptions() const { return unsigned(Values.size()); }
- const char *getOption(unsigned N) const { return Values[N].first; }
+ const char *getOption(unsigned N) const { return Values[N].Name; }
const char *getDescription(unsigned N) const {
- return Values[N].second.second;
+ return Values[N].HelpStr;
}
// parse - Return true on error.
@@ -465,8 +472,8 @@
for (unsigned i = 0, e = static_cast<unsigned>(Values.size());
i != e; ++i)
- if (Values[i].first == ArgVal) {
- V = Values[i].second.first;
+ if (Values[i].Name == ArgVal) {
+ V = Values[i].V;
return false;
}
@@ -478,8 +485,8 @@
template <class DT>
void addLiteralOption(const char *Name, const DT &V, const char *HelpStr) {
assert(findOption(Name) == Values.size() && "Option already exists!");
- Values.push_back(std::make_pair(Name,
- std::make_pair(static_cast<DataType>(V),HelpStr)));
+ OptionInfo X(Name, static_cast<DataType>(V), HelpStr);
+ Values.push_back(X);
MarkOptionsChanged();
}
Modified: llvm/trunk/include/llvm/Support/PassNameParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PassNameParser.h?rev=110485&r1=110484&r2=110485&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PassNameParser.h (original)
+++ llvm/trunk/include/llvm/Support/PassNameParser.h Fri Aug 6 18:03:52 2010
@@ -78,10 +78,9 @@
virtual void passEnumerate(const PassInfo *P) { passRegistered(P); }
// ValLessThan - Provide a sorting comparator for Values elements...
- typedef std::pair<const char*,
- std::pair<const PassInfo*, const char*> > ValType;
+ typedef PassNameParser::OptionInfo ValType;
static bool ValLessThan(const ValType &VT1, const ValType &VT2) {
- return std::string(VT1.first) < std::string(VT2.first);
+ return std::string(VT1.Name) < std::string(VT2.Name);
}
// printOptionInfo - Print out information about this option. Override the
More information about the llvm-commits
mailing list