[clang] [APINotes] Add SWIFT_RETURNS_(UN)RETAINED support (PR #118938)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 9 09:35:24 PST 2024


================
@@ -373,6 +373,13 @@ void ReadFunctionInfo(const uint8_t *&Data, FunctionInfo &Info) {
       endian::readNext<uint16_t, llvm::endianness::little>(Data);
   Info.ResultType = std::string(Data, Data + ResultTypeLen);
   Data += ResultTypeLen;
+
+  unsigned SwiftReturnOwnershipLength =
+      endian::readNext<uint16_t, llvm::endianness::little>(Data);
+  Info.SwiftReturnOwnership = std::string(reinterpret_cast<const char *>(Data),
+                                          reinterpret_cast<const char *>(Data) +
+                                              SwiftReturnOwnershipLength);
----------------
fahadnayyar wrote:

Makes sense @compnerd . I will start working on a follow up patch to convert other cases whic have a fixed/limited set of cases like SWIFT_SHARED_REFERENCE, etc to be implemented as Enums instead of `std:string`.

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


More information about the cfe-commits mailing list