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

Douglas Gregor dgregor at apple.com
Wed Jun 30 15:32:32 PDT 2010

On Jun 30, 2010, at 3:30 PM, Charles Davis wrote:

> On 6/30/10 2:58 PM, John McCall wrote:
>> On Jun 30, 2010, at 1:44 PM, Charles Davis wrote:
>>> 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).
>> Right, which was why I asked about it.
>> Does MSVC mangle any other kind of "sugar" differently?  Do all the following
>> have the same mangling?
>>  typedef int Int;
>>  typedef int IntArray[10];
>>  void foo(int x[10]);
>>  void foo(Int x[10]);
>>  void foo(IntArray x);
> They are all mangled the same (?foo@@YAXQAH at Z). I'm pretty sure that
> typedefs are canonicalized away (except in the case of anonymous tag types).

Here's a question: if you take the address of "foo", what type do you get? is the "const" in the resulting type?

	- Doug

More information about the cfe-commits mailing list