@@ -162,6 +162,7 @@ struct Method {
162162 bool DesignatedInit = false ;
163163 bool Required = false ;
164164 StringRef ResultType;
165+ StringRef SwiftReturnOwnership;
165166};
166167
167168typedef std::vector<Method> MethodsSeq;
@@ -196,6 +197,8 @@ template <> struct MappingTraits<Method> {
196197 IO.mapOptional (" DesignatedInit" , M.DesignatedInit , false );
197198 IO.mapOptional (" Required" , M.Required , false );
198199 IO.mapOptional (" ResultType" , M.ResultType , StringRef (" " ));
200+ IO.mapOptional (" SwiftReturnOwnership" , M.SwiftReturnOwnership ,
201+ StringRef (" " ));
199202 }
200203};
201204} // namespace yaml
@@ -291,6 +294,7 @@ struct Function {
291294 StringRef SwiftName;
292295 StringRef Type;
293296 StringRef ResultType;
297+ StringRef SwiftReturnOwnership;
294298};
295299
296300typedef std::vector<Function> FunctionsSeq;
@@ -313,6 +317,8 @@ template <> struct MappingTraits<Function> {
313317 IO.mapOptional (" SwiftPrivate" , F.SwiftPrivate );
314318 IO.mapOptional (" SwiftName" , F.SwiftName , StringRef (" " ));
315319 IO.mapOptional (" ResultType" , F.ResultType , StringRef (" " ));
320+ IO.mapOptional (" SwiftReturnOwnership" , F.SwiftReturnOwnership ,
321+ StringRef (" " ));
316322 }
317323};
318324} // namespace yaml
@@ -825,6 +831,7 @@ class YAMLConverter {
825831 emitError (" 'FactoryAsInit' is no longer valid; use 'SwiftName' instead" );
826832
827833 MI.ResultType = std::string (M.ResultType );
834+ MI.SwiftReturnOwnership = std::string (M.SwiftReturnOwnership );
828835
829836 // Translate parameter information.
830837 convertParams (M.Params , MI, MI.Self );
@@ -950,6 +957,7 @@ class YAMLConverter {
950957 convertNullability (Function.Nullability , Function.NullabilityOfRet , FI,
951958 Function.Name );
952959 FI.ResultType = std::string (Function.ResultType );
960+ FI.SwiftReturnOwnership = std::string (Function.SwiftReturnOwnership );
953961 FI.setRetainCountConvention (Function.RetainCountConvention );
954962 }
955963
0 commit comments