[cfe-dev] RFC: Flesh out the IRGen C++ ABI class

John McCall rjmccall at apple.com
Mon Oct 25 21:28:44 PDT 2010


On Oct 25, 2010, at 6:51 PM, Charles Davis wrote:

> On 10/25/10 6:34 AM, Charles Davis wrote:
>> On 10/25/10 2:34 AM, John McCall wrote:
>>> We'll also need some hook to override the default calling convention for
>>> instance methods.
>> True. The Sema CXXABI object also needs one, by the way.
> And I just realized. The getCanonicalCallConv() function turns CC_C into
> CC_Default. The problem is that for methods on x86 in the Microsoft ABI,
> CC_Default is the same as CC_X86ThisCall. I could just add a parameter
> to getCanonicalCallConv() to have it call the CXXABI hook, but then I
> need to know when to pass 'true' to get the right behavior.
> 
> The two places where getCanonicalCallConv() are called where this
> matters are ASTContext::getFunctionType() in lib/AST/ASTContext.cpp and
> ProcessFnAttr() in lib/Sema/SemaType.cpp. This is important so we get
> the right semantic analysis. Any ideas?

My inclination is to say that "canonicalizing" the function type is the wrong thing to do, and that the default CC for a function in any particular context should be determined by that context.  That means that a default-CC function type is different from a specifically-cdecl function type, but I can live with that.

John.



More information about the cfe-dev mailing list