summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-08-06 23:03:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-08-06 23:03:52 +0000
commit565aafc997ee08803e2a6f7544f183b9e796ba94 (patch)
tree8ea8927c61eb691bb9f431f869957300391b94ff
parent5eb308b9448ee5b14fac26c0533eac481bc28471 (diff)
downloadllvm-565aafc997ee08803e2a6f7544f183b9e796ba94.tar.gz
llvm-565aafc997ee08803e2a6f7544f183b9e796ba94.tar.bz2
llvm-565aafc997ee08803e2a6f7544f183b9e796ba94.tar.xz
Some cleanup. Use a class (OptionInfo) instead of a pair of a pair and remove
some default values that are not used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110485 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/PassSupport.h3
-rw-r--r--include/llvm/Support/CommandLine.h23
-rw-r--r--include/llvm/Support/PassNameParser.h5
3 files changed, 18 insertions, 13 deletions
diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h
index ee98713172..0ca955ba6b 100644
--- a/include/llvm/PassSupport.h
+++ b/include/llvm/PassSupport.h
@@ -53,8 +53,7 @@ public:
/// 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) {
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h
index 61c3256d38..35ec9c73ae 100644
--- a/include/llvm/Support/CommandLine.h
+++ b/include/llvm/Support/CommandLine.h
@@ -443,16 +443,23 @@ protected:
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 @@ public:
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 @@ public:
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();
}
diff --git a/include/llvm/Support/PassNameParser.h b/include/llvm/Support/PassNameParser.h
index cdca978cfe..b6d277581e 100644
--- a/include/llvm/Support/PassNameParser.h
+++ b/include/llvm/Support/PassNameParser.h
@@ -78,10 +78,9 @@ public:
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