[clang] [docs] Add a more detailed description in CXString.h. (PR #119090)

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 7 15:52:14 PST 2024


================
@@ -46,6 +46,9 @@ typedef struct {
 
 /**
  * Retrieve the character data associated with the given string.
+ *
+ * The caller shouldn't free the returned string data, and the returned string
+ * data shouldn't be accessed after the \c CXString disposed.
----------------
compnerd wrote:

I think that this is confusing. We could be more explicit about releasing the resources though as you point out.

```suggestion
 * The returned data is a reference and now owned by the user. This data
 * is only valid while the `CXString` is valid. This function is similar
 * to `std::string::c_str()`.
```

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


More information about the cfe-commits mailing list