[llvm-commits] [llvm] r153837 - in /llvm/trunk: include/llvm/MC/MCRegisterInfo.h utils/TableGen/RegisterInfoEmitter.cpp utils/TableGen/RegisterInfoEmitter.h
Benjamin Kramer
benny.kra at googlemail.com
Wed Apr 4 01:27:16 PDT 2012
On 04.04.2012, at 04:10, Anton Yartsev wrote:
> Hi Benjamin,
>
> just failed to compile Clang with MSVC8, found out that the problem seem to be caused by this commit.
>
> > class MCRegisterInfo {
> > public:
> > typedef const MCRegisterClass *regclass_iterator;
> > +
> > + /// DwarfLLVMRegPair - Emitted by tablegen so Dwarf<->LLVM reg mappings can be
> > + /// performed with a binary search.
> > + struct DwarfLLVMRegPair {
> > + unsigned FromReg;
> > + unsigned ToReg;
> > +
> > + bool operator==(unsigned Reg) const { return FromReg == Reg; }
> > + bool operator<(unsigned Reg) const { return FromReg < Reg; }
> > + };
>
> My workaround was to add the cast operator to the DwarfLLVMRegPair struct (patch attached)
> As seen from the "Microsoft Visual Studio 9.0\VC\include\xutility" both left to right and right to left comparisons are present:
>
> template<class _Ty1, class _Ty2> inline
> bool __CLRCALL_OR_CDECL _Debug_lt(const _Ty1& _Left, const _Ty2& _Right,
> const wchar_t *_Where, unsigned int _Line)
> { // test if _Left < _Right and operator< is strict weak ordering
> if (!(_Left < _Right))
> return (false);
> else if (_Right < _Left)
> _DEBUG_ERROR2("invalid operator<", _Where, _Line);
> return (true);
> }
>
> Is this the right fix?
>
> here is my build log:
>
> 1>------ Build started: Project: LLVMMC, Configuration: Debug Win32 ------
> 1>Compiling...
> 1>MCDwarf.cpp
> 1>MCContext.cpp
> 1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xutility(263) : error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const unsigned int' (or there is no acceptable conversion)
> 1> F:\llvm_TRC\include\llvm/ADT/StringRef.h(497): could be 'bool llvm::operator <(llvm::StringRef,llvm::StringRef)' [found using argument-dependent lookup]
> 1> while trying to match the argument list '(const unsigned int, const llvm::MCRegisterInfo::DwarfLLVMRegPair)'
> 1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(2264) : see reference to function template instantiation 'bool std::_Debug_lt<llvm::MCRegisterInfo::DwarfLLVMRegPair,_Ty>(const _Ty1 &,const _Ty2 &,const wchar_t *,unsigned int)' being compiled
> 1> with
> 1> [
> 1> _Ty=unsigned int,
> 1> _Ty1=llvm::MCRegisterInfo::DwarfLLVMRegPair,
> 1> _Ty2=unsigned int
> 1> ]
> 1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(2276) : see reference to function template instantiation '_FwdIt std::_Lower_bound<const llvm::MCRegisterInfo::DwarfLLVMRegPair*,_Ty,std::iterator_traits<_Iter>::difference_type>(_FwdIt,_FwdIt,const _Ty &,_Diff *)' being compiled
> 1> with
> 1> [
> 1> _FwdIt=const llvm::MCRegisterInfo::DwarfLLVMRegPair *,
> 1> _Ty=unsigned int,
> 1> _Iter=const llvm::MCRegisterInfo::DwarfLLVMRegPair *,
> 1> _Diff=std::iterator_traits<const llvm::MCRegisterInfo::DwarfLLVMRegPair *>::difference_type
> 1> ]
> 1> F:\llvm_TRC\include\llvm/MC/MCRegisterInfo.h(319) : see reference to function template instantiation '_FwdIt std::lower_bound<const llvm::MCRegisterInfo::DwarfLLVMRegPair*,unsigned int>(_FwdIt,_FwdIt,const _Ty &)' being compiled
> 1> with
> 1> [
> 1> _FwdIt=const llvm::MCRegisterInfo::DwarfLLVMRegPair *,
> 1> _Ty=unsigned int
> 1> ]
Hi Anton,
I don't particularly like the solution with operator unsigned, implicit conversions are often confusing. I took a slightly different approach in r154002 which should fix the MSVC8 build too.
Sorry for the breakage.
- Ben
More information about the llvm-commits
mailing list