aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-06 18:36:18 +0000
committerChris Lattner <sabre@nondot.org>2007-04-06 18:36:18 +0000
commit3b6078f584d856b3b0fb4dc3c4255502e605be1e (patch)
tree99963d9d11e947cfbaaf36ba9237b2158a23fb77 /include/llvm/Support
parentf6143ef556ed01311d2043d38421302479f7866c (diff)
downloadexternal_llvm-3b6078f584d856b3b0fb4dc3c4255502e605be1e.zip
external_llvm-3b6078f584d856b3b0fb4dc3c4255502e605be1e.tar.gz
external_llvm-3b6078f584d856b3b0fb4dc3c4255502e605be1e.tar.bz2
Switch some vectors to smallvectors. This reduces amount of malloc'd
memory that occurs before main starts from 5104 to 4864 bytes with a dummy example app. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35698 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/CommandLine.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h
index 69a3d6c..4758ff5 100644
--- a/include/llvm/Support/CommandLine.h
+++ b/include/llvm/Support/CommandLine.h
@@ -23,6 +23,7 @@
#include "llvm/Support/type_traits.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/ADT/SmallVector.h"
#include <string>
#include <vector>
#include <utility>
@@ -303,7 +304,7 @@ class ValuesClass {
// Use a vector instead of a map, because the lists should be short,
// the overhead is less, and most importantly, it keeps them in the order
// inserted so we can print our option out nicely.
- std::vector<std::pair<const char *, std::pair<int, const char *> > > Values;
+ SmallVector<std::pair<const char *, std::pair<int, const char *> >,4> Values;
void processValues(va_list Vals);
public:
ValuesClass(const char *EnumName, DataType Val, const char *Desc,
@@ -424,8 +425,8 @@ protected:
template <class DataType>
class parser : public generic_parser_base {
protected:
- std::vector<std::pair<const char *,
- std::pair<DataType, const char *> > > Values;
+ SmallVector<std::pair<const char *,
+ std::pair<DataType, const char *> >, 8> Values;
public:
typedef DataType parser_data_type;
@@ -454,7 +455,8 @@ public:
return O.error(": Cannot find option named '" + ArgVal + "'!");
}
- // addLiteralOption - Add an entry to the mapping table...
+ /// addLiteralOption - Add an entry to the mapping table.
+ ///
template <class DT>
void addLiteralOption(const char *Name, const DT &V, const char *HelpStr) {
assert(findOption(Name) == Values.size() && "Option already exists!");
@@ -462,8 +464,8 @@ public:
std::make_pair(static_cast<DataType>(V),HelpStr)));
}
- // removeLiteralOption - Remove the specified option.
- //
+ /// removeLiteralOption - Remove the specified option.
+ ///
void removeLiteralOption(const char *Name) {
unsigned N = findOption(Name);
assert(N != Values.size() && "Option not found!");