Skip to content

Commit f539fb5

Browse files
authored
[NFC][libclang][Dependency Scanning] Document Link Library Related C-APIs' Return Values' Lifetimes #11009
#10994 added C-APIs to query link library information from dependency scanning results. This PR adds documentation on the return values' lifetimes.
1 parent fddd461 commit f539fb5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

clang/include/clang-c/Dependencies.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,8 @@ typedef struct CXOpaqueDepGraphModuleLinkLibrary *CXDepGraphModuleLinkLibrary;
752752
/**
753753
* Get the set of link libraries given a \c CXDepGraphModule instance.
754754
* The returned set is a pointer into memory that the \c CXDepGraphModule
755-
* instance owns. Therefore the set does not need to be disposed.
755+
* instance owns. Therefore the set does not need to be disposed, and it has
756+
* the same lifetime as the \c CXDepGraphModule instance.
756757
*/
757758
CINDEX_LINKAGE CXDepGraphModuleLinkLibrarySet
758759
clang_experimental_DepGraphModule_getLinkLibrarySet(CXDepGraphModule);
@@ -765,7 +766,10 @@ CINDEX_LINKAGE size_t clang_experimental_DepGraphModuleLinkLibrarySet_getSize(
765766

766767
/**
767768
* Retrieve the \c CXDepGraphModuleLinkLibrary instance at index \p Idx from the
768-
* \c CXDepGraphModuleLinkLibrarySet instance.
769+
* \c CXDepGraphModuleLinkLibrarySet instance. The returned object is owned
770+
* by the \c CXDepGraphModule instance where the
771+
* \c CXDepGraphModuleLinkLibrarySet was retrieved from, and has the same
772+
* lifetime as the \c CXDepGraphModule instance.
769773
*/
770774
CINDEX_LINKAGE CXDepGraphModuleLinkLibrary
771775
clang_experimental_DepGraphModuleLinkLibrarySet_getLinkLibrary(
@@ -775,7 +779,9 @@ clang_experimental_DepGraphModuleLinkLibrarySet_getLinkLibrary(
775779
* Get the `Library` string from the \c CXDepGraphModuleLinkLibrary instance.
776780
* `Library` could be a library name, or an absolute path to a library or a
777781
* framework, as specified in the corresponding \c CXDepGraphModule instance's
778-
* modulemap.
782+
* modulemap. The returned \c CXString is a reference to a string owned
783+
* by the \c CXDepGraphModule instance, and has the same lifetime as the
784+
* the \c CXDepGraphModule instance.
779785
*/
780786
CINDEX_LINKAGE CXString clang_experimental_DepGraphModuleLinkLibrary_getLibrary(
781787
CXDepGraphModuleLinkLibrary);

0 commit comments

Comments
 (0)