[cfe-commits] r107264 - in /cfe/trunk: lib/CodeGen/MicrosoftCXXABI.cpp test/CodeGenCXX/mangle-ms.cpp

Charles Davis cdavis at mymail.mines.edu
Wed Jun 30 13:44:53 PDT 2010

On 6/30/10 2:10 PM, John McCall wrote:
> On Jun 30, 2010, at 1:05 PM, Charles Davis wrote:
>> The "proper" way IMO is to store it in the FunctionType's argument list as an IncompleteArrayType and have canonicalization of the function type decay it to a pointer. Then the mangler will detect that it's mangling a parameter array and mangle it as a const pointer. At least, there really should be some way of detecting that a parameter was declared as an array instead of a pointer.
> The type-as-written for the parameter declaration remembers this.
How do you get that from a FunctionType? As far as I know, you need a
FunctionDecl to get the ParmVarDecls. We don't always have
one--particularly when we're mangling pointers to functions (which I
haven't really looked at yet).
> How does MSVC mangle this in function types that aren't function declarations?  Like, does it mangle these identically or not?
>   void foo(void (*fn)(int x[10]));
>   void foo(void (*fn)(int * const x));
They have exactly the same mangling (?foo@@YAXP6AXQAH at Z@Z). (The name
demangles to the second declaration, by the way.) MSVC even complains
when you define them in the same translation unit.


More information about the cfe-commits mailing list