[cfe-dev] clang::MangleContext::shouldMangleDeclName

John McCall rjmccall at apple.com
Thu Oct 25 01:35:17 PDT 2012


On Oct 25, 2012, at 12:01 AM, Vassil Vassilev wrote:
> On 10/24/12 11:07 PM, John McCall wrote:
>> On Oct 24, 2012, at 2:03 PM, John McCall wrote:
>>> On Oct 24, 2012, at 2:20 AM, Vassil Vassilev wrote:
>>>> shouldMangleDeclName returns true for decls like EnumConstantDecl.
>>>> Is that expected behaviour? Am I missing something?
>>> It doesn't really return anything meaningful for declarations that
>>> obviously aren't mangled.
>> To clarify, that query is only meaningful for declarations that can be
>> directly referenced as global symbols.  It's not meaningful for, say,
>> enum constants or classes or using declarations.
>> 
>> John.
> Thanks for the answer, John!
> 
> It's somehow contra-intuitive for shouldMangleDeclName to return true for decls that aren't/can't be mangled.

The point of the function is to decide whether the linking symbol for the declaration should be mangled, as opposed to simply being the same as its identifier.  It does not make sense to ask whether to mangle the linking symbol of a declaration that does not have a linking symbol.  If you would like to prepare a patch to have this function assert when given an EnumConstantDecl, that would be acceptable;  but otherwise I see no reason to prefer any particular answer.

John.



More information about the cfe-dev mailing list