[clang] [libclang] Replace createRef with createDup (PR #126683)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 19 11:35:11 PST 2025


================
@@ -77,19 +77,6 @@ CXString createDup(const char *String) {
   return Str;
 }
 
-CXString createRef(StringRef String) {
-  if (!String.data())
-    return createNull();
-
-  // If the string is empty, it might point to a position in another string
-  // while having zero length. Make sure we don't create a reference to the
-  // larger string.
-  if (String.empty())
----------------
AaronBallman wrote:

Oh, I see what you mean, that is a difference in behavior for the null case because `clang_getCString()` (part of the stable API) would start returning a non-null pointer where it previously returned a null pointer. I'm not certain if any of the changed calls to `createDup()` will get a null `StringRef` though, that's a pretty odd beast.

https://github.com/llvm/llvm-project/pull/126683


More information about the cfe-commits mailing list