From 689d747a498e7ead320af1fc84ed08050acbd527 Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Fri, 11 Jan 2013 23:08:18 +0000 Subject: [PATCH] libclang: constness for CXString git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172270 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang-c/CXString.h | 2 +- tools/libclang/CXString.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/clang-c/CXString.h b/include/clang-c/CXString.h index 74c31660ef..34cab5e7bd 100644 --- a/include/clang-c/CXString.h +++ b/include/clang-c/CXString.h @@ -36,7 +36,7 @@ extern "C" { * with the string data, call \c clang_disposeString() to free the string. */ typedef struct { - void *data; + const void *data; unsigned private_flags; } CXString; diff --git a/tools/libclang/CXString.cpp b/tools/libclang/CXString.cpp index c4ab3f4f1b..1c49e2c2d8 100644 --- a/tools/libclang/CXString.cpp +++ b/tools/libclang/CXString.cpp @@ -35,7 +35,7 @@ CXString cxstring::createCXString(const char *String, bool DupString){ Str.data = strdup(String); Str.private_flags = (unsigned) CXS_Malloc; } else { - Str.data = (void*)String; + Str.data = String; Str.private_flags = (unsigned) CXS_Unmanaged; } return Str; @@ -50,7 +50,7 @@ CXString cxstring::createCXString(StringRef String, bool DupString) { Result.data = Spelling; Result.private_flags = (unsigned) CXS_Malloc; } else { - Result.data = (void*) String.data(); + Result.data = String.data(); Result.private_flags = (unsigned) CXS_Unmanaged; } return Result; @@ -123,7 +123,7 @@ void clang_disposeString(CXString string) { break; case CXS_Malloc: if (string.data) - free((void*)string.data); + free(const_cast(string.data)); break; case CXS_StringBuf: disposeCXStringBuf((CXStringBuf *) string.data); -- 2.40.0