[llvm] r263870 - Fix a const_cast related warning in GCC in the C API for libLTO

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 19 11:34:30 PDT 2016


Does LTOObjectBuffer actually need to modify? Or is it just const
incorrect/should be constified? (if it does need to modify, perhaps we need
to change the API here to expose something other than a MemoryBuffer for
use here to document the mutability?)

On Fri, Mar 18, 2016 at 6:24 PM, Mehdi Amini via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: mehdi_amini
> Date: Fri Mar 18 20:24:23 2016
> New Revision: 263870
>
> URL: http://llvm.org/viewvc/llvm-project?rev=263870&view=rev
> Log:
> Fix a const_cast related warning in GCC in the C API for libLTO
>
> From: Mehdi Amini <mehdi.amini at apple.com>
>
> Modified:
>     llvm/trunk/tools/lto/lto.cpp
>
> Modified: llvm/trunk/tools/lto/lto.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=263870&r1=263869&r2=263870&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/lto/lto.cpp (original)
> +++ llvm/trunk/tools/lto/lto.cpp Fri Mar 18 20:24:23 2016
> @@ -469,7 +469,7 @@ LTOObjectBuffer thinlto_module_get_objec
>                                            unsigned int index) {
>    assert(index < unwrap(cg)->getProducedBinaries().size() && "Index
> overflow");
>    auto &MemBuffer = unwrap(cg)->getProducedBinaries()[index];
> -  return LTOObjectBuffer{(void *)MemBuffer->getBufferStart(),
> +  return LTOObjectBuffer{const_cast<char *>(MemBuffer->getBufferStart()),
>                           MemBuffer->getBufferSize()};
>  }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160319/c5a37f46/attachment.html>


More information about the llvm-commits mailing list