================
@@ -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:
@xTachyon Thank you for checking it out! I personally still prefer the general
direction that this patch is heading.
I have to admit that bringing back the `CXSMalloc` is still a thorny
business... I am thinking about just move those constructor into an
`internal.h` headers. They will be just `static inline`s and will only ever be
used by `c-index-test` and will never be installed. So a question to
@AaronBallman, do you find this idea of deploying an internal only header file
acceptable? If so, I will make one more commit for this clean-up I will post
another patch to @xTachyon.
https://github.com/llvm/llvm-project/pull/134551
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits