================
@@ -926,11 +935,17 @@ class YAMLConverter {
                          TheNamespace.Items, SwiftVersion);
   }
 
-  void convertFunction(const Function &Function, FunctionInfo &FI) {
+  template <typename FuncOrMethodInfo>
+  void convertFunction(const Function &Function, FuncOrMethodInfo &FI) {
     convertAvailability(Function.Availability, FI, Function.Name);
     FI.setSwiftPrivate(Function.SwiftPrivate);
     FI.SwiftName = std::string(Function.SwiftName);
-    convertParams(Function.Params, FI);
+    if constexpr (std::is_same_v<FuncOrMethodInfo, CXXMethodInfo>) {
+      FI.This = convertParams(Function.Params, FI);
+    } else {
+      if (convertParams(Function.Params, FI))
+        emitError("position -1 is only valid for C++ and Objective-C methods");
----------------
compnerd wrote:

```suggestion
        emitError("implicit instance parameter is only permitted on C++ and 
Objective-C methods");
```

Let's try to avoid the explicit value we use for the representation in the 
diagnostic.

https://github.com/llvm/llvm-project/pull/115021
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to