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

via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 7 11:29:51 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: iseki (iseki0)

<details>
<summary>Changes</summary>

Emmm... Maybe I'm splitting hairs. But I really think the paragraph should be more detailed. The orginal document makes me confused. Do I take the ownership of the string data? 
Here I don't refer the `clang_disposeString` function, because here's a `clang_disposeStringSet`. 

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


1 Files Affected:

- (modified) clang/include/clang-c/CXString.h (+3) 


``````````diff
diff --git a/clang/include/clang-c/CXString.h b/clang/include/clang-c/CXString.h
index f117010c71a462..27375913e4cc19 100644
--- a/clang/include/clang-c/CXString.h
+++ b/clang/include/clang-c/CXString.h
@@ -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.
  */
 CINDEX_LINKAGE const char *clang_getCString(CXString string);
 

``````````

</details>


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


More information about the cfe-commits mailing list