[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:02 PST 2024


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

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`. 

>From 06be29809a8ac03e4ec9546e1dcfc138ab79167b Mon Sep 17 00:00:00 2001
From: iseki zero <admin at iseki.space>
Date: Sun, 8 Dec 2024 03:17:40 +0800
Subject: [PATCH] [docs] Add a more detailed description in CXString.h.

---
 clang/include/clang-c/CXString.h | 3 +++
 1 file changed, 3 insertions(+)

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);
 



More information about the cfe-commits mailing list