[cfe-commits] r172270 - in /cfe/trunk: include/clang-c/CXString.h tools/libclang/CXString.cpp
Dmitri Gribenko
gribozavr at gmail.com
Fri Jan 11 15:08:18 PST 2013
Author: gribozavr
Date: Fri Jan 11 17:08:18 2013
New Revision: 172270
URL: http://llvm.org/viewvc/llvm-project?rev=172270&view=rev
Log:
libclang: constness for CXString
Modified:
cfe/trunk/include/clang-c/CXString.h
cfe/trunk/tools/libclang/CXString.cpp
Modified: cfe/trunk/include/clang-c/CXString.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/CXString.h?rev=172270&r1=172269&r2=172270&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/CXString.h (original)
+++ cfe/trunk/include/clang-c/CXString.h Fri Jan 11 17:08:18 2013
@@ -36,7 +36,7 @@
* with the string data, call \c clang_disposeString() to free the string.
*/
typedef struct {
- void *data;
+ const void *data;
unsigned private_flags;
} CXString;
Modified: cfe/trunk/tools/libclang/CXString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXString.cpp?rev=172270&r1=172269&r2=172270&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXString.cpp (original)
+++ cfe/trunk/tools/libclang/CXString.cpp Fri Jan 11 17:08:18 2013
@@ -35,7 +35,7 @@
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 @@
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 @@
break;
case CXS_Malloc:
if (string.data)
- free((void*)string.data);
+ free(const_cast<void *>(string.data));
break;
case CXS_StringBuf:
disposeCXStringBuf((CXStringBuf *) string.data);
More information about the cfe-commits
mailing list