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

Matt Johnson johnso87 at crhc.illinois.edu
Sun Aug 14 21:20:33 PDT 2011

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: apint_constructor.diff
Type: text/x-diff
Size: 739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20110814/be6118aa/attachment.diff>

More information about the lldb-commits mailing list