- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
Add arrangeCXXMethodCall to the CodeGenABITypes interface. #111597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| ✅ With the latest revision this PR passed the C/C++ code formatter. | 
7be9488    to
    4744991      
    Compare
  
    | @llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: Hiroshi Yamauchi (hjyamauchi) ChangesIn MSVC, the calling conventions for free functions and C++ instance methods could be different, it makes sense to have this variant there. Full diff: https://github.com/llvm/llvm-project/pull/111597.diff 2 Files Affected: 
 diff --git a/clang/include/clang/CodeGen/CodeGenABITypes.h b/clang/include/clang/CodeGen/CodeGenABITypes.h
index 9cbc5a8a2a3f41..3d29c45cf0cf1b 100644
--- a/clang/include/clang/CodeGen/CodeGenABITypes.h
+++ b/clang/include/clang/CodeGen/CodeGenABITypes.h
@@ -75,6 +75,12 @@ const CGFunctionInfo &arrangeCXXMethodType(CodeGenModule &CGM,
                                            const FunctionProtoType *FTP,
                                            const CXXMethodDecl *MD);
 
+const CGFunctionInfo &arrangeCXXMethodCall(CodeGenModule &CGM,
+                                           CanQualType returnType,
+                                           ArrayRef<CanQualType> argTypes,
+                                           FunctionType::ExtInfo info,
+                                           RequiredArgs args);
+
 const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM,
                                               CanQualType returnType,
                                               ArrayRef<CanQualType> argTypes,
diff --git a/clang/lib/CodeGen/CodeGenABITypes.cpp b/clang/lib/CodeGen/CodeGenABITypes.cpp
index a6073e1188d6fa..972bc4137c6053 100644
--- a/clang/lib/CodeGen/CodeGenABITypes.cpp
+++ b/clang/lib/CodeGen/CodeGenABITypes.cpp
@@ -59,6 +59,14 @@ CodeGen::arrangeCXXMethodType(CodeGenModule &CGM,
   return CGM.getTypes().arrangeCXXMethodType(RD, FTP, MD);
 }
 
+const CGFunctionInfo &
+CodeGen::arrangeCXXMethodCall(CodeGenModule &CGM, CanQualType returnType,
+                              ArrayRef<CanQualType> argTypes,
+                              FunctionType::ExtInfo info, RequiredArgs args) {
+  return CGM.getTypes().arrangeLLVMFunctionInfo(
+      returnType, FnInfoOpts::IsInstanceMethod, argTypes, info, {}, args);
+}
+
 const CGFunctionInfo &
 CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM,
                                  CanQualType returnType,
 | 
| CanQualType returnType, | ||
| ArrayRef<CanQualType> argTypes, | ||
| FunctionType::ExtInfo info, | ||
| RequiredArgs args); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.  The internal function for this now takes an array of ExtParameterInfos.  As long as we're introducing new API, could you go ahead and add that parameter to these functions?  You'll need to either add overloads or give it a default argument (an empty array is an acceptable default).
You just need to modify the functions that don't take a FunctionProtoType.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjmccall Updated. Do you mean like the latest revision?
1c7101f    to
    98f58ce      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that looks good.
98f58ce    to
    1ccc7c1      
    Compare
  
    Also add ExtParameterInfos to the argument list of arrangeFreeFunctionCall.
1ccc7c1    to
    ae4cdf4      
    Compare
  
    Also add ExtParameterInfos to the argument list of arrangeFreeFunctionCall. Cherrypick llvm#111597
Also add ExtParameterInfos to the argument list of arrangeFreeFunctionCall. Cherrypick PR llvm#111597
In MSVC, the calling conventions for free functions and C++ instance methods could be different, it makes sense to have this variant there.