[lldb-dev] [PATCH] std::vector::data()

William Lynch wlynch at wlynch.cx
Tue Jul 20 17:15:08 PDT 2010


Thank you for fixing it up!

Since we're on the subject of missing standard library methods, I figured
now would be a good time to bring up this patch as well. I don't have a
std::bitset::to_string() on Leopard either.

The implementation was pulled from
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/bitset?view=markup

-Bill

Index: source/Core/DataExtractor.cpp
===================================================================
--- source/Core/DataExtractor.cpp (revision 108959)
+++ source/Core/DataExtractor.cpp (working copy)
@@ -1197,7 +1197,13 @@
         case eFormatBinary:
             {
                 uint64_t uval64 = GetMaxU64Bitfield(&offset,
item_byte_size, item_bit_size, item_bit_offset);
-                std::string
binary_value(std::bitset<64>(uval64).to_string());
+
+                std::string binary_value(64, '0');
+                std::bitset<64> bits(uval64);
+                for (size_t i = 0; i < 64; ++i)
+                    if (bits[i])
+                        binary_value[64 - 1 - i] = '1';
+
                 if (item_bit_size > 0)
                     s->Printf("0b%s", binary_value.c_str() + 64 -
item_bit_size);
                 else if (item_byte_size > 0 && item_byte_size <= 8)



On Tue, Jul 20, 2010 at 5:55 PM, Greg Clayton <gclayton at apple.com> wrote:

> Modified version of this patch was submitted with r108957.
>
> Thanks for catching this William.
>
> Greg Clayton
>
> On Jul 20, 2010, at 2:21 PM, William Lynch wrote:
>
> > Hello,
> >
> > I've attached a fairly large patch (touches 21 files).
> >
> > The point of this patch is to remove all calls to std::vector::data()
> with &std::vector::front(). Apparently on CentOS 5 and Leopard, that method
> is not part of std::vector.
> >
> > As a side note, should I be submitting these patches to this list or to
> lldb-commits?
> >
> > Thanks!
> > <foo.patch>_______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20100720/254f4769/attachment.html>


More information about the lldb-dev mailing list