[Lldb-commits] [PATCH] Disambiguate APInt() call, fix build on GCC 4.5.2

Greg Clayton gclayton at apple.com
Mon Aug 15 00:25:21 PDT 2011


Patch looks good, thanks Matt.

% svn commit
Sending        source/Core/DataExtractor.cpp
Transmitting file data .
Committed revision 137605.


On Aug 14, 2011, at 9:20 PM, Matt Johnson wrote:

> Hi All,
> r137602 added a call to the (deprecated; see llvm/include/llvm/ADT/APInt.h) APInt constructor that takes a size and pointer for a word array. The reason this constructor is deprecated is that it is prone to ambiguity with another constructor that takes a single word and a bool that denotes the signedness of the value. The deprecated constructor has been supplanted by one that takes a single ArrayRef parameter that encapsulates the size and a pointer to the word array. The attached patch calls the other constructor instead, and avoids the following build-breaker on gcc 4.5.2:
> 
> DataExtractor.cpp: In function ‘uint32_t DumpAPInt(lldb_private::Stream*, const lldb_private::DataExtractor&, uint32_t, uint32_t, bool, unsigned int)’:
> DataExtractor.cpp:1362:55: error: call of overloaded ‘APInt(uint32_t, llvm::SmallVectorTemplateCommon<long unsigned int>::size_type, uint64_t*)’ is ambiguous
> /media/d2/llvm/include/llvm/ADT/APInt.h:250:3: note: candidates are: llvm::APInt::APInt(unsigned int, unsigned int, const uint64_t*)
> /media/d2/llvm/include/llvm/ADT/APInt.h:227:3: note: llvm::APInt::APInt(unsigned int, uint64_t, bool)
> 
> You can also get around this error by casting the second argument to (unsigned), but I think this solution is cleaner.
> 
> Best,
> Matt
> <apint_constructor.diff>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list