summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/Support/CommandLine.h
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2015-05-28 20:47:02 +0000
committerChris Bieneman <beanz@apple.com>2015-05-28 20:47:02 +0000
commitbcb6ddc0a412f4b1f12ceb5ef0b2d209f3cc1678 (patch)
tree65c96cfe6d3d5f8fc34f04bde43875844951aa6c /llvm/include/llvm/Support/CommandLine.h
parent80956a01425ee0b6e0fd5a7d732b1b288be28a4c (diff)
downloadbcm5719-llvm-bcb6ddc0a412f4b1f12ceb5ef0b2d209f3cc1678.tar.gz
bcm5719-llvm-bcb6ddc0a412f4b1f12ceb5ef0b2d209f3cc1678.zip
Revert "Refactoring cl::list_storage from "is a" to "has a" std::vector."
This reverts commit 117715ca0613d3db144241499401f2ec5398f1d5. llvm-svn: 238491
Diffstat (limited to 'llvm/include/llvm/Support/CommandLine.h')
-rw-r--r--llvm/include/llvm/Support/CommandLine.h59
1 files changed, 7 insertions, 52 deletions
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 24630dbbdc1..bd1d1cb6dc9 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -1284,61 +1284,16 @@ public:
}
};
-// Define how to hold a class type object, such as a string.
-// Originally this code inherited from std::vector. In transitioning to a new
-// API for command line options we should change this. The new implementation
-// of this list_storage specialization implements the minimum subset of the
-// std::vector API required for all the current clients.
-//
-// FIXME: Reduce this API to a more narrow subset of std::vector
+// Define how to hold a class type object, such as a string. Since we can
+// inherit from a class, we do so. This makes us exactly compatible with the
+// object in all cases that it is used.
//
-template <class DataType> class list_storage<DataType, bool> {
- std::vector<DataType> Storage;
-
+template <class DataType>
+class list_storage<DataType, bool> : public std::vector<DataType> {
public:
- typedef typename std::vector<DataType>::iterator iterator;
-
- iterator begin() { return Storage.begin(); }
- iterator end() { return Storage.end(); }
-
- typedef typename std::vector<DataType>::const_iterator const_iterator;
- const_iterator begin() const { return Storage.begin(); }
- const_iterator end() const { return Storage.end(); }
-
- typedef typename std::vector<DataType>::size_type size_type;
- size_type size() const { return Storage.size(); }
-
- bool empty() const { return Storage.empty(); }
-
- void push_back(const DataType &value) { Storage.push_back(value); }
- void push_back(DataType &&value) { Storage.push_back(value); }
-
- typedef typename std::vector<DataType>::reference reference;
- typedef typename std::vector<DataType>::const_reference const_reference;
- reference operator[](size_type pos) { return Storage[pos]; }
- const_reference operator[](size_type pos) const { return Storage[pos]; }
-
- iterator erase(const_iterator pos) { return Storage.erase(pos); }
- iterator erase(const_iterator first, const_iterator last) {
- return Storage.erase(first, last);
- }
-
- iterator insert(const_iterator pos, const DataType &value) {
- return Storage.insert(pos, value);
- }
- iterator insert(const_iterator pos, DataType &&value) {
- return Storage.insert(pos, value);
+ template <class T> void addValue(const T &V) {
+ std::vector<DataType>::push_back(V);
}
-
- reference front() { return Storage.front(); }
- const_reference front() const { return Storage.front(); }
-
- operator std::vector<DataType>&() { return Storage; }
- operator ArrayRef<DataType>() { return Storage; }
- std::vector<DataType> *operator&() { return &Storage; }
- const std::vector<DataType> *operator&() const { return &Storage; }
-
- template <class T> void addValue(const T &V) { Storage.push_back(V); }
};
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud