OSDN Git Service

Const-correctness in libLTO
authorMehdi Amini <mehdi.amini@apple.com>
Sat, 19 Mar 2016 21:28:18 +0000 (21:28 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Sat, 19 Mar 2016 21:28:18 +0000 (21:28 +0000)
Looks like I was sloppy when bridging to C.
Thanks D. Blaikie for noticing!

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263885 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm-c/lto.h
tools/lto/lto.cpp

index 44f7bea..88b10fd 100644 (file)
@@ -564,7 +564,7 @@ lto_codegen_set_should_embed_uselists(lto_code_gen_t cg,
  * \since LTO_API_VERSION=18
  */
 typedef struct {
-  void *Buffer;
+  const char *Buffer;
   size_t Size;
 } LTOObjectBuffer;
 
index 3af8f7d..165b23d 100644 (file)
@@ -469,7 +469,7 @@ LTOObjectBuffer thinlto_module_get_object(thinlto_code_gen_t cg,
                                           unsigned int index) {
   assert(index < unwrap(cg)->getProducedBinaries().size() && "Index overflow");
   auto &MemBuffer = unwrap(cg)->getProducedBinaries()[index];
-  return LTOObjectBuffer{const_cast<char *>(MemBuffer->getBufferStart()),
+  return LTOObjectBuffer{MemBuffer->getBufferStart(),
                          MemBuffer->getBufferSize()};
 }