[llvm] r238505 - Re-landing "Refactoring cl::list_storage from "is a" to "has a" std::vector."
Chris Bieneman
cbieneman at apple.com
Thu May 28 15:07:58 PDT 2015
And I gave you the wrong revision for the fix. It was r238509. I’m watching the bots closely to make sure that fix works.
-Chris
> On May 28, 2015, at 3:06 PM, Hans Wennborg <hans at chromium.org> wrote:
>
> That build was with r238505 :-/
>
> On Thu, May 28, 2015 at 2:57 PM, Chris Bieneman <cbieneman at apple.com> wrote:
>> Yep. That should be fixed with r238505.
>>
>> -Chris
>>
>>> On May 28, 2015, at 2:55 PM, Hans Wennborg <hans at chromium.org> wrote:
>>>
>>> This bot still doesn't seem happy:
>>> http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/24831/steps/build_llvm/logs/stdio
>>>
>>> On Thu, May 28, 2015 at 2:31 PM, Chris Bieneman <beanz at apple.com> wrote:
>>>> Author: cbieneman
>>>> Date: Thu May 28 16:31:22 2015
>>>> New Revision: 238505
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=238505&view=rev
>>>> Log:
>>>> Re-landing "Refactoring cl::list_storage from "is a" to "has a" std::vector."
>>>>
>>>> Originally landed r238485
>>>>
>>>> MSVC resolves identifiers differently from Clang and GCC, this resulted in build bot failures. This pach re-lands r238485 and fixes the build failures.
>>>>
>>>> Modified:
>>>> llvm/trunk/include/llvm/Support/CommandLine.h
>>>>
>>>> Modified: llvm/trunk/include/llvm/Support/CommandLine.h
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=238505&r1=238504&r2=238505&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/include/llvm/Support/CommandLine.h (original)
>>>> +++ llvm/trunk/include/llvm/Support/CommandLine.h Thu May 28 16:31:22 2015
>>>> @@ -1284,24 +1284,69 @@ public:
>>>> }
>>>> };
>>>>
>>>> -// 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.
>>>> +// 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.
>>>> //
>>>> -template <class DataType>
>>>> -class list_storage<DataType, bool> : public std::vector<DataType> {
>>>> +// FIXME: Reduce this API to a more narrow subset of std::vector
>>>> +//
>>>> +template <class DataType> class list_storage<DataType, bool> {
>>>> + std::vector<DataType> Storage;
>>>> +
>>>> public:
>>>> - template <class T> void addValue(const T &V) {
>>>> - std::vector<DataType>::push_back(V);
>>>> + 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);
>>>> }
>>>> +
>>>> + 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); }
>>>> };
>>>>
>>>> //===----------------------------------------------------------------------===//
>>>> // list - A list of command line options.
>>>> //
>>>> -template <class DataType, class Storage = bool,
>>>> +template <class DataType, class StorageClass = bool,
>>>> class ParserClass = parser<DataType>>
>>>> -class list : public Option, public list_storage<DataType, Storage> {
>>>> +class list : public Option, public list_storage<DataType, StorageClass> {
>>>> std::vector<unsigned> Positions;
>>>> ParserClass Parser;
>>>>
>>>> @@ -1319,7 +1364,7 @@ class list : public Option, public list_
>>>> typename ParserClass::parser_data_type();
>>>> if (Parser.parse(*this, ArgName, Arg, Val))
>>>> return true; // Parse Error!
>>>> - list_storage<DataType, Storage>::addValue(Val);
>>>> + list_storage<DataType, StorageClass>::addValue(Val);
>>>> setPosition(pos);
>>>> Positions.push_back(pos);
>>>> return false;
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
More information about the llvm-commits
mailing list