================
@@ -25,14 +25,19 @@ enum CXStringFlag {
/// CXString contains a 'const char *' that it doesn't own.
CXS_Unmanaged,
- /// CXString contains a 'const char *' that it allocated with malloc().
- CXS_Malloc,
+ /// CXString contains a 'CStringImpl' that it allocated with malloc().
+ CXS_MallocWithSize,
/// CXString contains a CXStringBuf that needs to be returned to the
/// CXStringPool.
CXS_StringBuf
};
+struct CStringImpl {
+ size_t length;
+ char buffer[sizeof(length)];
----------------
dingxiangfei2009 wrote:
cc @AaronBallman
I will leave [the patch here
first](https://gist.github.com/dingxiangfei2009/711a1b5db4b24507da2010d40d6fbba6).
The idea is that we prefix the internal `CXString` constructor with
`internal_` so that it will not be collected into the list of exported symbols.
Unfortunately the linker script still has to specify it as a global symbol. The
bottom line is we are not shipping the header containing its prototype,
effectively keeping it only visible in this project.
So what do you think? Is it something we can go along with?
https://github.com/llvm/llvm-project/pull/134551
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits