[llvm] r217018 - Recommit "Use unique_ptr to manager FilterChooser ownership."

Yaron Keren yaron.keren at gmail.com
Wed Sep 3 01:33:51 PDT 2014


OK, I fixed the ambiguity in r217023 to unbreak the build and
clang-formatted these two lines.

Yaron



2014-09-03 11:26 GMT+03:00 Yaron Keren <yaron.keren at gmail.com>:

> Hi Craig,
>
> This fails to compile under VC 2013:
>
> 1>------ Build started: Project: llvm-tblgen, Configuration:
> RelWithDebInfo Win32 ------
> 1>  FixedLenDecoderEmitter.cpp
> 1>..\..\..\utils\TableGen\FixedLenDecoderEmitter.cpp(560): error C2668:
> 'llvm::make_unique' : ambiguous call to overloaded function
> 1>          C:\llvm\include\llvm/ADT/STLExtras.h(393): could be
> 'std::unique_ptr<`anonymous-namespace'::FilterChooser,std::default_delete<`anonymous-namespace'::FilterChooser>>
> llvm::make_unique<`anonymous-namespace'::FilterChooser,const
> std::vector<const llvm::CodeGenInstruction
> *,std::allocator<_Ty>>&,std::vector<unsigned
> int,std::allocator<char32_t>>&,const std::map<unsigned
> int,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>>>>&,std::vector<bit_value_t,std::allocator<bit_value_t>>&,const
> `anonymous-namespace'::FilterChooser&>(const
> std::vector<_Ty,std::allocator<_Ty>> &,std::vector<unsigned
> int,std::allocator<char32_t>> &,const
> std::map<_Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>>>>
> &,std::vector<bit_value_t,std::allocator<bit_value_t>> &,const
> `anonymous-namespace'::FilterChooser &)'
> 1>          with
> 1>          [
> 1>              _Ty=const llvm::CodeGenInstruction *
> 1>  ,            _Kty=unsigned int
> 1>          ]
> 1>          C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\include\memory(1637): or
> 'std::unique_ptr<`anonymous-namespace'::FilterChooser,std::default_delete<`anonymous-namespace'::FilterChooser>>
> std::make_unique<`anonymous-namespace'::FilterChooser,const
> std::vector<const llvm::CodeGenInstruction
> *,std::allocator<_Ty>>&,std::vector<unsigned
> int,std::allocator<char32_t>>&,const std::map<unsigned
> int,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>>>>&,std::vector<bit_value_t,std::allocator<bit_value_t>>&,const
> `anonymous-namespace'::FilterChooser&>(const
> std::vector<_Ty,std::allocator<_Ty>> &,std::vector<unsigned
> int,std::allocator<char32_t>> &,const
> std::map<_Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>>>>
> &,std::vector<bit_value_t,std::allocator<bit_value_t>> &,const
> `anonymous-namespace'::FilterChooser &)' [found using argument-dependent
> lookup]
> 1>          with
> 1>          [
> 1>              _Ty=const llvm::CodeGenInstruction *
> 1>  ,            _Kty=unsigned int
> 1>          ]
> 1>          while trying to match the argument list '(const
> std::vector<const llvm::CodeGenInstruction *,std::allocator<_Ty>>,
> std::vector<unsigned int,std::allocator<char32_t>>, const std::map<unsigned
> int,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<_Ty>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<_Ty,std::allocator<_Ty>>>>>,
> std::vector<bit_value_t,std::allocator<_Ty>>, const
> `anonymous-namespace'::FilterChooser)'
> 1>          with
> 1>          [
> 1>              _Ty=const llvm::CodeGenInstruction *
> 1>          ]
> 1>          and
> 1>          [
> 1>              _Ty=`anonymous-namespace'::OperandInfo
> 1>  ,            _Kty=unsigned int
> 1>          ]
> 1>          and
> 1>          [
> 1>              _Ty=bit_value_t
> 1>          ]
> 1>..\..\..\utils\TableGen\FixedLenDecoderEmitter.cpp(560): error C2780:
> 'std::pair<_Unrefwrap<_Ty>::type,_Unrefwrap<_Ty2>::type>
> std::make_pair(_Ty1 &&,_Ty2 &&)' : expects 2 arguments - 1 provided
> 1>          C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\include\utility(267) : see declaration of 'std::make_pair'
> 1>..\..\..\utils\TableGen\FixedLenDecoderEmitter.cpp(592): error C2668:
> 'llvm::make_unique' : ambiguous call to overloaded function
> 1>          C:\llvm\include\llvm/ADT/STLExtras.h(393): could be
> 'std::unique_ptr<`anonymous-namespace'::FilterChooser,std::default_delete<`anonymous-namespace'::FilterChooser>>
> llvm::make_unique<`anonymous-namespace'::FilterChooser,const
> std::vector<const llvm::CodeGenInstruction *,std::allocator<_Ty>>&,const
> _Ty2&,const std::map<unsigned
> int,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>>>>&,std::vector<bit_value_t,std::allocator<bit_value_t>>&,const
> `anonymous-namespace'::FilterChooser&>(const
> std::vector<_Ty,std::allocator<_Ty>> &,const _Ty2 &,const
> std::map<_Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>>>>
> &,std::vector<bit_value_t,std::allocator<bit_value_t>> &,const
> `anonymous-namespace'::FilterChooser &)'
> 1>          with
> 1>          [
> 1>              _Ty=const llvm::CodeGenInstruction *
> 1>  ,            _Ty2=std::vector<unsigned int,std::allocator<char32_t>>
> 1>  ,            _Kty=unsigned int
> 1>          ]
> 1>          C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\include\memory(1637): or
> 'std::unique_ptr<`anonymous-namespace'::FilterChooser,std::default_delete<`anonymous-namespace'::FilterChooser>>
> std::make_unique<`anonymous-namespace'::FilterChooser,const
> std::vector<const llvm::CodeGenInstruction *,std::allocator<_Ty>>&,const
> _Ty2&,const std::map<unsigned
> int,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>>>>&,std::vector<bit_value_t,std::allocator<bit_value_t>>&,const
> `anonymous-namespace'::FilterChooser&>(const
> std::vector<_Ty,std::allocator<_Ty>> &,const _Ty2 &,const
> std::map<_Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<`anonymous-namespace'::OperandInfo>>>>>
> &,std::vector<bit_value_t,std::allocator<bit_value_t>> &,const
> `anonymous-namespace'::FilterChooser &)' [found using argument-dependent
> lookup]
> 1>          with
> 1>          [
> 1>              _Ty=const llvm::CodeGenInstruction *
> 1>  ,            _Ty2=std::vector<unsigned int,std::allocator<char32_t>>
> 1>  ,            _Kty=unsigned int
> 1>          ]
> 1>          while trying to match the argument list '(const
> std::vector<const llvm::CodeGenInstruction *,std::allocator<_Ty>>, const
> std::vector<unsigned int,std::allocator<char32_t>>, const std::map<unsigned
> int,std::vector<`anonymous-namespace'::OperandInfo,std::allocator<_Ty>>,std::less<_Kty>,std::allocator<std::pair<const
> _Kty,std::vector<_Ty,std::allocator<_Ty>>>>>,
> std::vector<bit_value_t,std::allocator<_Ty>>, const
> `anonymous-namespace'::FilterChooser)'
> 1>          with
> 1>          [
> 1>              _Ty=const llvm::CodeGenInstruction *
> 1>          ]
> 1>          and
> 1>          [
> 1>              _Ty=`anonymous-namespace'::OperandInfo
> 1>  ,            _Kty=unsigned int
> 1>          ]
> 1>          and
> 1>          [
> 1>              _Ty=bit_value_t
> 1>          ]
> 1>..\..\..\utils\TableGen\FixedLenDecoderEmitter.cpp(592): error C2780:
> 'std::pair<_Unrefwrap<_Ty>::type,_Unrefwrap<_Ty2>::type>
> std::make_pair(_Ty1 &&,_Ty2 &&)' : expects 2 arguments - 1 provided
> 1>          C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\include\utility(267) : see declaration of 'std::make_pair'
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>
>
>
>
> 2014-09-03 9:45 GMT+03:00 Justin Bogner <mail at justinbogner.com>:
>
>> Craig Topper <craig.topper at gmail.com> writes:
>> > Author: ctopper
>> > Date: Wed Sep  3 01:07:54 2014
>> > New Revision: 217018
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=217018&view=revLog:
>> > Recommit "Use unique_ptr to manager FilterChooser ownership."
>> >
>> > Just using insert of a pair this time instead of emplace.
>> >
>> > Modified:
>> >     llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
>> >
>> > Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
>> > URL:
>> >
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=217018&r1=217017&r2=217018&view=diff==============================================================================
>> > --- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original)
>> > +++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Wed Sep  3
>> 01:07:54 2014
>> > @@ -230,7 +230,7 @@ protected:
>> >    std::vector<unsigned> VariableInstructions;
>> >
>> >    // Map of well-known segment value to its delegate.
>> > -  std::map<unsigned, const FilterChooser*> FilterChooserMap;
>> > +  std::map<unsigned, std::unique_ptr<const FilterChooser>>
>> FilterChooserMap;
>> >
>> >    // Number of instructions which fall under FilteredInstructions
>> category.
>> >    unsigned NumFiltered;
>> > @@ -530,12 +530,6 @@ Filter::Filter(FilterChooser &owner, uns
>> >  }
>> >
>> >  Filter::~Filter() {
>> > -  std::map<unsigned, const FilterChooser*>::iterator filterIterator;
>> > -  for (filterIterator = FilterChooserMap.begin();
>> > -       filterIterator != FilterChooserMap.end();
>> > -       filterIterator++) {
>> > -    delete filterIterator->second;
>> > -  }
>> >  }
>> >
>> >  // Divides the decoding task into sub tasks and delegates them to the
>> > @@ -557,14 +551,13 @@ void Filter::recurse() {
>> >
>> >      // Delegates to an inferior filter chooser for further processing
>> on this
>> >      // group of instructions whose segment values are variable.
>> > -    FilterChooserMap.insert(std::pair<unsigned, const FilterChooser*>(
>> > -                              (unsigned)-1,
>> > -                              new FilterChooser(Owner->AllInstructions,
>> > -                                                VariableInstructions,
>> > -                                                Owner->Operands,
>> > -                                                BitValueArray,
>> > -                                                *Owner)
>> > -                              ));
>> > +    FilterChooserMap.insert(std::make_pair(
>> > +                              -1U,
>> > +
>> make_unique<FilterChooser>(Owner->AllInstructions,
>> > +
>>  VariableInstructions,
>> > +
>>  Owner->Operands,
>> > +                                                         BitValueArray,
>> > +                                                         *Owner)));
>>
>> This indentation's a bit out there. Might be nice to clang-format these
>> while you're here.
>>
>> >    }
>> >
>> >    // No need to recurse for a singleton filtered instruction.
>> > @@ -590,14 +583,13 @@ void Filter::recurse() {
>> >
>> >      // Delegates to an inferior filter chooser for further processing
>> on this
>> >      // category of instructions.
>> > -    FilterChooserMap.insert(std::pair<unsigned, const FilterChooser*>(
>> > +    FilterChooserMap.insert(std::make_pair(
>> >                                mapIterator->first,
>> > -                              new FilterChooser(Owner->AllInstructions,
>> > -                                                mapIterator->second,
>> > -                                                Owner->Operands,
>> > -                                                BitValueArray,
>> > -                                                *Owner)
>> > -                              ));
>> > +
>> make_unique<FilterChooser>(Owner->AllInstructions,
>> > +
>>  mapIterator->second,
>> > +
>>  Owner->Operands,
>> > +                                                         BitValueArray,
>> > +                                                         *Owner)));
>> >    }
>> >  }
>> >
>> > @@ -632,7 +624,8 @@ void Filter::emitTableEntry(DecoderTable
>> >    // A new filter entry begins a new scope for fixup resolution.
>> >    TableInfo.FixupStack.push_back(FixupList());
>> >
>> > -  std::map<unsigned, const FilterChooser*>::const_iterator
>> filterIterator;
>> > +  std::map<unsigned,
>> > +           std::unique_ptr<const FilterChooser>>::const_iterator
>> filterIterator;
>> >
>> >    DecoderTable &Table = TableInfo.Table;
>> >
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140903/c0f6ed30/attachment.html>


More information about the llvm-commits mailing list